ReactOS  0.4.14-dev-593-g1793dcc
internet.c File Reference
#include "config.h"
#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 "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 "wine/exception.h"
#include "internet.h"
#include "resource.h"
#include "wine/unicode.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 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 const WCHAR szProxyServer [] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 }
 
static const WCHAR szProxyEnable [] = { 'P','r','o','x','y','E','n','a','b','l','e', 0 }
 
static const WCHAR szProxyOverride [] = { 'P','r','o','x','y','O','v','e','r','r','i','d','e', 0 }
 
static proxyinfo_tglobal_proxy
 
static const object_vtbl_t APPINFOVtbl
 
static const WCHAR url_schemes [][7]
 
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 4046 of file internet.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 57 of file internet.c.

◆ URL_GET_COMP_LENGTH

#define URL_GET_COMP_LENGTH (   url,
  component 
)
Value:
((url)->dw##component##Length ? \
(url)->dw##component##Length : strlenW((url)->lpsz##component))
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static const WCHAR url[]
Definition: encode.c:1432
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101

Definition at line 4048 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))
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static const WCHAR url[]
Definition: encode.c:1432
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101

Definition at line 4050 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 3777 of file internet.c.

3778 {
3779  task_header_t *task;
3780 
3781  task = heap_alloc(size);
3782  if(!task)
3783  return NULL;
3784 
3785  task->hdr = WININET_AddRef(hdr);
3786  task->proc = proc;
3787  return task;
3788 }
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
smooth NULL
Definition: ftsmooth.c:416
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:177
GLsizeiptr size
Definition: glext.h:5919
object_header_t * hdr
Definition: internet.h:391
async_task_proc_t proc
Definition: internet.h:390

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 111 of file internet.c.

112 {
113  UINT_PTR handle = 0, num;
115  object_header_t **p;
116  BOOL res = TRUE;
117 
118  ret = heap_alloc_zero(size);
119  if(!ret)
120  return NULL;
121 
122  list_init(&ret->children);
123 
125 
126  if(!handle_table_size) {
127  num = 16;
128  p = heap_alloc_zero(sizeof(handle_table[0]) * num);
129  if(p) {
130  handle_table = p;
132  next_handle = 1;
133  }else {
134  res = FALSE;
135  }
136  }else if(next_handle == handle_table_size) {
137  num = handle_table_size * 2;
138  p = heap_realloc_zero(handle_table, sizeof(handle_table[0]) * num);
139  if(p) {
140  handle_table = p;
142  }else {
143  res = FALSE;
144  }
145  }
146 
147  if(res) {
149  if(handle_table[handle])
150  ERR("handle isn't free but should be\n");
152  ret->valid_handle = TRUE;
153 
155  next_handle++;
156  }
157 
159 
160  if(!res) {
161  heap_free(ret);
162  return NULL;
163  }
164 
165  ret->vtbl = vtbl;
166  ret->refs = 1;
167  ret->hInternet = (HINTERNET)handle;
168 
169  if(parent) {
170  ret->lpfnStatusCB = parent->lpfnStatusCB;
171  ret->dwInternalFlags = parent->dwInternalFlags & INET_CALLBACKW;
172  }
173 
174  return ret;
175 }
LPVOID HINTERNET
Definition: winhttp.h:32
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define INET_CALLBACKW
Definition: internet.h:245
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static UINT_PTR next_handle
Definition: internet.c:88
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2869
static UINT_PTR handle_table_size
Definition: internet.c:89
static CRITICAL_SECTION WININET_cs
Definition: internet.c:78
GLuint GLuint num
Definition: glext.h:9618
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int ret
#define ERR(fmt,...)
Definition: debug.h:109
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 797 of file internet.c.

798 {
799  appinfo_t *lpwai = (appinfo_t*)hdr;
800 
801  TRACE("%p\n",lpwai);
802 
803  heap_free(lpwai->agent);
804  heap_free(lpwai->proxy);
805  heap_free(lpwai->proxyBypass);
806  heap_free(lpwai->proxyUsername);
807  heap_free(lpwai->proxyPassword);
808 }
char hdr[14]
Definition: iptest.cpp:33
LPWSTR proxyUsername
Definition: internet.h:296
LPWSTR proxyPassword
Definition: internet.h:297
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR proxy
Definition: internet.h:294
LPWSTR agent
Definition: internet.h:293
LPWSTR proxyBypass
Definition: internet.h:295
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 810 of file internet.c.

811 {
812  appinfo_t *ai = (appinfo_t*)hdr;
813 
814  switch(option) {
816  TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
817 
818  if (*size < sizeof(ULONG))
820 
821  *size = sizeof(DWORD);
823  return ERROR_SUCCESS;
824 
826  DWORD bufsize;
827 
828  TRACE("INTERNET_OPTION_USER_AGENT\n");
829 
830  bufsize = *size;
831 
832  if (unicode) {
833  DWORD len = ai->agent ? strlenW(ai->agent) : 0;
834 
835  *size = (len + 1) * sizeof(WCHAR);
836  if(!buffer || bufsize < *size)
838 
839  if (ai->agent)
840  strcpyW(buffer, ai->agent);
841  else
842  *(WCHAR *)buffer = 0;
843  /* If the buffer is copied, the returned length doesn't include
844  * the NULL terminator.
845  */
846  *size = len;
847  }else {
848  if (ai->agent)
849  *size = WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, NULL, 0, NULL, NULL);
850  else
851  *size = 1;
852  if(!buffer || bufsize < *size)
854 
855  if (ai->agent)
856  WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, buffer, *size, NULL, NULL);
857  else
858  *(char *)buffer = 0;
859  /* If the buffer is copied, the returned length doesn't include
860  * the NULL terminator.
861  */
862  *size -= 1;
863  }
864 
865  return ERROR_SUCCESS;
866  }
867 
869  if(!size) return ERROR_INVALID_PARAMETER;
870  if (unicode) {
872  DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
873  LPWSTR proxy, proxy_bypass;
874 
875  if (ai->proxy)
876  proxyBytesRequired = (lstrlenW(ai->proxy) + 1) * sizeof(WCHAR);
877  if (ai->proxyBypass)
878  proxyBypassBytesRequired = (lstrlenW(ai->proxyBypass) + 1) * sizeof(WCHAR);
879  if (!pi || *size < sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired)
880  {
881  *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
883  }
885  proxy_bypass = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired);
886 
887  pi->dwAccessType = ai->accessType;
888  pi->lpszProxy = NULL;
889  pi->lpszProxyBypass = NULL;
890  if (ai->proxy) {
891  lstrcpyW(proxy, ai->proxy);
892  pi->lpszProxy = proxy;
893  }
894 
895  if (ai->proxyBypass) {
896  lstrcpyW(proxy_bypass, ai->proxyBypass);
897  pi->lpszProxyBypass = proxy_bypass;
898  }
899 
900  *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
901  return ERROR_SUCCESS;
902  }else {
904  DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
905  LPSTR proxy, proxy_bypass;
906 
907  if (ai->proxy)
908  proxyBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, NULL, 0, NULL, NULL);
909  if (ai->proxyBypass)
910  proxyBypassBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1,
911  NULL, 0, NULL, NULL);
912  if (!pi || *size < sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired)
913  {
914  *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
916  }
917  proxy = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA));
918  proxy_bypass = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired);
919 
920  pi->dwAccessType = ai->accessType;
921  pi->lpszProxy = NULL;
922  pi->lpszProxyBypass = NULL;
923  if (ai->proxy) {
924  WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, proxy, proxyBytesRequired, NULL, NULL);
925  pi->lpszProxy = proxy;
926  }
927 
928  if (ai->proxyBypass) {
929  WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1, proxy_bypass,
930  proxyBypassBytesRequired, NULL, NULL);
931  pi->lpszProxyBypass = proxy_bypass;
932  }
933 
934  *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
935  return ERROR_SUCCESS;
936  }
937 
939  TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
940 
941  if (*size < sizeof(ULONG))
943 
944  *(ULONG*)buffer = ai->connect_timeout;
945  *size = sizeof(ULONG);
946 
947  return ERROR_SUCCESS;
948  }
949 
950  return INET_QueryOption(hdr, option, buffer, size, unicode);
951 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
int proxy
Definition: main.c:67
char hdr[14]
Definition: iptest.cpp:33
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static LPWSTR
Definition: internet.c:38
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:415
#define INTERNET_OPTION_PROXY
Definition: wininet.h:732
static DWORD
Definition: internet.c:33
unsigned char * LPBYTE
Definition: typedefs.h:52
DWORD accessType
Definition: internet.h:298
smooth NULL
Definition: ftsmooth.c:416
Definition: getopt.h:108
DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
Definition: internet.c:2531
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static LPSTR
Definition: internet.c:37
#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:294
DWORD connect_timeout
Definition: internet.h:299
GLenum GLsizei len
Definition: glext.h:6722
#define INTERNET_OPTION_USER_AGENT
Definition: wininet.h:735
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define lstrcpyW
Definition: compat.h:414
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:293
LPWSTR proxyBypass
Definition: internet.h:295
#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 953 of file internet.c.

954 {
955  appinfo_t *ai = (appinfo_t*)hdr;
956 
957  switch(option) {
959  TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
960 
961  if(size != sizeof(connect_timeout))
963  if(!*(ULONG*)buf)
964  return ERROR_BAD_ARGUMENTS;
965 
966  ai->connect_timeout = *(ULONG*)buf;
967  return ERROR_SUCCESS;
969  heap_free(ai->agent);
970  if (!(ai->agent = heap_strdupW(buf))) return ERROR_OUTOFMEMORY;
971  return ERROR_SUCCESS;
973  FIXME("INTERNET_OPTION_REFRESH\n");
974  return ERROR_SUCCESS;
975  }
976 
977  return INET_SetOption(hdr, option, buf, size);
978 }
char hdr[14]
Definition: iptest.cpp:33
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD INET_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
Definition: internet.c:2630
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:232
#define ERROR_INTERNET_BAD_OPTION_LENGTH
Definition: wininet.h:1999
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
#define FIXME(fmt,...)
Definition: debug.h:110
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:101
DWORD connect_timeout
Definition: internet.h:299
#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:293
#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 3593 of file internet.c.

3594 {
3596 
3597  TRACE("%p\n", task->hdr.hdr);
3598 
3599  INTERNET_InternetOpenUrlW((appinfo_t*)task->hdr.hdr, task->url, task->headers,
3600  task->headers_len, task->flags, task->context);
3601  heap_free(task->url);
3602  heap_free(task->headers);
3603 }
char hdr[14]
Definition: iptest.cpp:33
DWORD headers_len
Definition: internet.c:3588
WCHAR * headers
Definition: internet.c:3587
#define TRACE(s)
Definition: solgame.cpp:4
object_header_t * hdr
Definition: internet.h:391
task_header_t hdr
Definition: internet.c:3585
static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3485
DWORD_PTR context
Definition: internet.c:3590
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by InternetOpenUrlW().

◆ calc_url_length()

static BOOL calc_url_length ( LPURL_COMPONENTSW  lpUrlComponents,
LPDWORD  lpdwUrlLength 
)
static

Definition at line 4099 of file internet.c.

4101 {
4102  INTERNET_SCHEME nScheme;
4103 
4104  *lpdwUrlLength = 0;
4105 
4106  if (lpUrlComponents->lpszScheme)
4107  {
4108  DWORD dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
4109  *lpdwUrlLength += dwLen;
4110  nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
4111  }
4112  else
4113  {
4114  LPCWSTR scheme;
4115 
4116  nScheme = lpUrlComponents->nScheme;
4117 
4118  if (nScheme == INTERNET_SCHEME_DEFAULT)
4119  nScheme = INTERNET_SCHEME_HTTP;
4120  scheme = INTERNET_GetSchemeString(nScheme);
4121  *lpdwUrlLength += strlenW(scheme);
4122  }
4123 
4124  (*lpdwUrlLength)++; /* ':' */
4125  if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
4126  *lpdwUrlLength += strlen("//");
4127 
4128  if (lpUrlComponents->lpszUserName)
4129  {
4130  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
4131  *lpdwUrlLength += strlen("@");
4132  }
4133  else
4134  {
4135  if (lpUrlComponents->lpszPassword)
4136  {
4138  return FALSE;
4139  }
4140  }
4141 
4142  if (lpUrlComponents->lpszPassword)
4143  {
4144  *lpdwUrlLength += strlen(":");
4145  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, Password);
4146  }
4147 
4148  if (lpUrlComponents->lpszHostName)
4149  {
4150  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
4151 
4152  if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
4153  {
4154  char szPort[MAX_WORD_DIGITS+1];
4155 
4156  *lpdwUrlLength += sprintf(szPort, "%d", lpUrlComponents->nPort);
4157  *lpdwUrlLength += strlen(":");
4158  }
4159 
4160  if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
4161  (*lpdwUrlLength)++; /* '/' */
4162  }
4163 
4164  if (lpUrlComponents->lpszUrlPath)
4165  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
4166 
4167  if (lpUrlComponents->lpszExtraInfo)
4168  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
4169 
4170  return TRUE;
4171 }
static BOOL url_uses_default_port(INTERNET_SCHEME nScheme, INTERNET_PORT nPort)
Definition: internet.c:4053
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
LPWSTR lpszExtraInfo
Definition: winhttp.h:478
LPWSTR lpszUrlPath
Definition: winhttp.h:476
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
void INTERNET_SetLastError(DWORD dwError)
Definition: internet.c:3720
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
DWORD scheme
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
Definition: internet.c:1619
INTERNET_SCHEME nScheme
Definition: winhttp.h:468
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:4046
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:4048
LPWSTR lpszScheme
Definition: winhttp.h:466
static BOOL scheme_is_opaque(INTERNET_SCHEME nScheme)
Definition: internet.c:4076
static LPCWSTR INTERNET_GetSchemeString(INTERNET_SCHEME scheme)
Definition: internet.c:4085

Referenced by InternetCreateUrlW().

◆ convert_url_canonicalization_flags()

static DWORD convert_url_canonicalization_flags ( DWORD  dwFlags)
static

Definition at line 1975 of file internet.c.

1976 {
1978 
1979  if (dwFlags & ICU_BROWSER_MODE) dwUrlFlags |= URL_BROWSER_MODE;
1980  if (dwFlags & ICU_DECODE) dwUrlFlags |= URL_UNESCAPE;
1981  if (dwFlags & ICU_ENCODE_PERCENT) dwUrlFlags |= URL_ESCAPE_PERCENT;
1983  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
1984  if (dwFlags & ICU_NO_ENCODE) dwUrlFlags ^= URL_ESCAPE_UNSAFE;
1985  if (dwFlags & ICU_NO_META) dwUrlFlags |= URL_NO_META;
1986 
1987  return dwUrlFlags;
1988 }
#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 4173 of file internet.c.

4174 {
4175  INT len;
4176 
4177  ZeroMemory(urlCompW, sizeof(URL_COMPONENTSW));
4178 
4179  urlCompW->dwStructSize = sizeof(URL_COMPONENTSW);
4180  urlCompW->dwSchemeLength = lpUrlComponents->dwSchemeLength;
4181  urlCompW->nScheme = lpUrlComponents->nScheme;
4182  urlCompW->dwHostNameLength = lpUrlComponents->dwHostNameLength;
4183  urlCompW->nPort = lpUrlComponents->nPort;
4184  urlCompW->dwUserNameLength = lpUrlComponents->dwUserNameLength;
4185  urlCompW->dwPasswordLength = lpUrlComponents->dwPasswordLength;
4186  urlCompW->dwUrlPathLength = lpUrlComponents->dwUrlPathLength;
4187  urlCompW->dwExtraInfoLength = lpUrlComponents->dwExtraInfoLength;
4188 
4189  if (lpUrlComponents->lpszScheme)
4190  {
4191  len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1;
4192  urlCompW->lpszScheme = heap_alloc(len * sizeof(WCHAR));
4193  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme,
4194  -1, urlCompW->lpszScheme, len);
4195  }
4196 
4197  if (lpUrlComponents->lpszHostName)
4198  {
4199  len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1;
4200  urlCompW->lpszHostName = heap_alloc(len * sizeof(WCHAR));
4201  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName,
4202  -1, urlCompW->lpszHostName, len);
4203  }
4204 
4205  if (lpUrlComponents->lpszUserName)
4206  {
4207  len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1;
4208  urlCompW->lpszUserName = heap_alloc(len * sizeof(WCHAR));
4209  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName,
4210  -1, urlCompW->lpszUserName, len);
4211  }
4212 
4213  if (lpUrlComponents->lpszPassword)
4214  {
4215  len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1;
4216  urlCompW->lpszPassword = heap_alloc(len * sizeof(WCHAR));
4217  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword,
4218  -1, urlCompW->lpszPassword, len);
4219  }
4220 
4221  if (lpUrlComponents->lpszUrlPath)
4222  {
4223  len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1;
4224  urlCompW->lpszUrlPath = heap_alloc(len * sizeof(WCHAR));
4225  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath,
4226  -1, urlCompW->lpszUrlPath, len);
4227  }
4228 
4229  if (lpUrlComponents->lpszExtraInfo)
4230  {
4231  len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1;
4232  urlCompW->lpszExtraInfo = heap_alloc(len * sizeof(WCHAR));
4233  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo,
4234  -1, urlCompW->lpszExtraInfo, len);
4235  }
4236 }
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:4050
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:99
LPSTR lpszUrlPath
Definition: wininet.h:204
DWORD dwUrlPathLength
Definition: winhttp.h:477
#define ZeroMemory
Definition: winbase.h:1642
int32_t INT
Definition: typedefs.h:56
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:100
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 3871 of file internet.c.

3872 {
3873  req_file_t *req_file;
3874 
3875  req_file = heap_alloc_zero(sizeof(*req_file));
3876  if(!req_file)
3877  return ERROR_NOT_ENOUGH_MEMORY;
3878 
3879  req_file->ref = 1;
3880 
3881  req_file->file_name = heap_strdupW(file_name);
3882  if(!req_file->file_name) {
3883  heap_free(req_file);
3884  return ERROR_NOT_ENOUGH_MEMORY;
3885  }
3886 
3889  if(req_file->file_handle == INVALID_HANDLE_VALUE) {
3890  req_file_release(req_file);
3891  return GetLastError();
3892  }
3893 
3894  *ret = req_file;
3895  return ERROR_SUCCESS;
3896 }
void req_file_release(req_file_t *req_file)
Definition: internet.c:3898
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG ref
Definition: internet.h:249
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
smooth NULL
Definition: ftsmooth.c:416
HANDLE file_handle
Definition: internet.h:250
#define OPEN_EXISTING
Definition: compat.h:434
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
static LPCWSTR file_name
Definition: protocol.c:147
#define CreateFileW
Definition: compat.h:408
WCHAR * file_name
Definition: internet.h:251
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 4573 of file internet.c.

4575 {
4576  FIXME("(%s, %s, %s, %p) stub\n", debugstr_w(pszChallengeInfo), debugstr_w(pwszRealm),
4577  debugstr_w(pwszTarget), pbHexHash);
4578  return FALSE;
4579 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ DetectAutoProxyUrl()

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

Definition at line 470 of file internet.c.

472 {
473  FIXME("STUB\n");
475  return FALSE;
476 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 325 of file internet.c.

326 {
327  FIXME("(%x %s): stub\n", bInstall, debugstr_w(cmdline));
328  return S_OK;
329 }
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ DllMain()

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

Definition at line 274 of file internet.c.

275 {
276  TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
277 
278  switch (fdwReason) {
279  case DLL_PROCESS_ATTACH:
280 
282 
284  return FALSE;
285 
286  if(!init_urlcache())
287  {
289  return FALSE;
290  }
291 
292  WININET_hModule = hinstDLL;
293  break;
294 
295  case DLL_THREAD_ATTACH:
296  break;
297 
298  case DLL_THREAD_DETACH:
300  {
302  }
303  break;
304 
305  case DLL_PROCESS_DETACH:
306  if (lpvReserved) break;
308  NETCON_unload();
309  free_urlcache();
310  free_cookie();
311 
313  {
316  }
317  break;
318  }
319  return TRUE;
320 }
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_THREAD_DETACH
Definition: compat.h:122
static IN DWORD IN LPVOID lpvReserved
void free_urlcache(void) DECLSPEC_HIDDEN
Definition: urlcache.c:4142
HMODULE WININET_hModule
Definition: internet.c:76
#define DLL_PROCESS_DETACH
Definition: compat.h:119
#define TRACE(s)
Definition: solgame.cpp:4
BOOL init_urlcache(void) DECLSPEC_HIDDEN
Definition: urlcache.c:4124
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1154
BOOL collect_connections(collect_type_t collect_type)
Definition: http.c:310
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1088
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
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:75
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ dump_INTERNET_FLAGS()

static void dump_INTERNET_FLAGS ( DWORD  dwFlags)
static

Definition at line 743 of file internet.c.

744 {
745 #define FE(x) { x, #x }
746  static const wininet_flag_info flag[] = {
775  };
776 #undef FE
777  unsigned int i;
778 
779  for (i = 0; i < ARRAY_SIZE(flag); i++) {
780  if (flag[i].val & dwFlags) {
781  TRACE(" %s", flag[i].name);
782  dwFlags &= ~flag[i].val;
783  }
784  }
785  if (dwFlags)
786  TRACE(" Unknown flags (%08x)\n", dwFlags);
787  else
788  TRACE("\n");
789 }
#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
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 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
#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 488 of file internet.c.

489 {
491  if (global_proxy)
492  {
495  }
497 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static proxyinfo_t * global_proxy
Definition: internet.c:486
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:478
static CRITICAL_SECTION WININET_cs
Definition: internet.c:78
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 478 of file internet.c.

479 {
480  heap_free(lpwpi->proxy);
481  heap_free(lpwpi->proxyBypass);
482  heap_free(lpwpi->proxyUsername);
483  heap_free(lpwpi->proxyPassword);
484 }
LPWSTR proxyBypass
Definition: internet.c:95
LPWSTR proxyPassword
Definition: internet.c:97
LPWSTR proxyUsername
Definition: internet.c:96
LPWSTR proxy
Definition: internet.c:94
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_handle_object()

object_header_t* get_handle_object ( HINTERNET  hinternet)

Definition at line 184 of file internet.c.

185 {
187  UINT_PTR handle = (UINT_PTR) hinternet;
188 
190 
193 
195 
196  TRACE("handle %ld -> %p\n", handle, info);
197 
198  return info;
199 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _test_info info[]
Definition: SetCursorPos.c:19
__inline int valid_handle(HANDLE handle)
Definition: util.h:281
smooth NULL
Definition: ftsmooth.c:416
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:177
#define TRACE(s)
Definition: solgame.cpp:4
static UINT_PTR handle_table_size
Definition: internet.c:89
static CRITICAL_SECTION WININET_cs
Definition: internet.c:78
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
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 2301 of file internet.c.

2302 {
2303 #if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
2304 
2305  CFDictionaryRef settings = CFNetworkCopySystemProxySettings();
2306  WCHAR *ret = NULL;
2307  SIZE_T len;
2308  const void *ref;
2309 
2310  if (!settings) return NULL;
2311 
2312  if (!(ref = CFDictionaryGetValue( settings, kCFNetworkProxiesProxyAutoConfigURLString )))
2313  {
2314  CFRelease( settings );
2315  return NULL;
2316  }
2317  len = CFStringGetLength( ref );
2318  if (len)
2319  ret = heap_alloc( (len+1) * sizeof(WCHAR) );
2320  if (ret)
2321  {
2322  CFStringGetCharacters( ref, CFRangeMake(0, len), ret );
2323  ret[len] = 0;
2324  }
2325  TRACE( "returning %s\n", debugstr_w(ret) );
2326  CFRelease( settings );
2327  return ret;
2328 #else
2329  static int once;
2330  if (!once++) FIXME( "no support on this platform\n" );
2331  return NULL;
2332 #endif
2333 }
struct mke2fs_defaults settings[]
Definition: send.c:47
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define debugstr_w
Definition: kernel32.h:32
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
ULONG_PTR SIZE_T
Definition: typedefs.h:78

Referenced by query_global_option().

◆ GetInternetSchemeW()

static INTERNET_SCHEME GetInternetSchemeW ( LPCWSTR  lpszScheme,
DWORD  nMaxCmp 
)
static

Definition at line 1619 of file internet.c.

1620 {
1621  int i;
1622 
1623  TRACE("%s %d\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp);
1624 
1625  if(lpszScheme==NULL)
1626  return INTERNET_SCHEME_UNKNOWN;
1627 
1628  for (i = 0; i < ARRAY_SIZE(url_schemes); i++)
1629  if (!strncmpiW(lpszScheme, url_schemes[i], nMaxCmp))
1630  return INTERNET_SCHEME_FIRST + i;
1631 
1632  return INTERNET_SCHEME_UNKNOWN;
1633 }
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
static const WCHAR url_schemes[][7]
Definition: internet.c:1597
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_wn
Definition: kernel32.h:33
#define ARRAY_SIZE(a)
Definition: main.h:24

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 2531 of file internet.c.

2532 {
2533  switch(option) {
2535  if (!size)
2536  return ERROR_INVALID_PARAMETER;
2537 
2538  if (*size < sizeof(DWORD_PTR)) {
2539  *size = sizeof(DWORD_PTR);
2541  }
2542  if (!buffer)
2543  return ERROR_INVALID_PARAMETER;
2544 
2545  *(DWORD_PTR *)buffer = hdr->dwContext;
2546  *size = sizeof(DWORD_PTR);
2547  return ERROR_SUCCESS;
2548 
2550  WARN("INTERNET_OPTION_REQUEST_FLAGS\n");
2551  *size = sizeof(DWORD);
2553 
2556  WARN("Called on global option %u\n", option);
2558  }
2559 
2560  /* FIXME: we shouldn't call it here */
2561  return query_global_option(option, buffer, size, unicode);
2562 }
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
Definition: wininet.h:2007
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
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:111
GLuint buffer
Definition: glext.h:5915
static DWORD
Definition: internet.c:33
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:2335
uint32_t DWORD_PTR
Definition: typedefs.h:63
#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 2630 of file internet.c.

2631 {
2632  switch(option) {
2634  FIXME("INTERNETOPTION_SETTINGS_CHANGED semi-stub\n");
2636  return ERROR_SUCCESS;
2638  WARN("Not settable option %u\n", option);
2642  WARN("Called on global option %u\n", option);
2646  }
2647 
2649 }
#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:111
#define FIXME(fmt,...)
Definition: debug.h:110
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:310
#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 3693 of file internet.c.

3694 {
3695  LPWITHREADERROR lpwite = heap_alloc(sizeof(*lpwite));
3696 
3697  if (lpwite)
3698  {
3699  lpwite->dwError = 0;
3700  lpwite->response[0] = '\0';
3701  }
3702 
3703  if (!TlsSetValue(g_dwTlsErrIndex, lpwite))
3704  {
3705  heap_free(lpwite);
3706  return NULL;
3707  }
3708  return lpwite;
3709 }
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1264
CHAR response[MAX_REPLY_LEN]
Definition: internet.c:72
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
DWORD dwError
Definition: internet.c:71
smooth NULL
Definition: ftsmooth.c:416
static DWORD g_dwTlsErrIndex
Definition: internet.c:75
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 3798 of file internet.c.

3799 {
3800  BOOL bSuccess;
3801 
3802  TRACE("\n");
3803 
3805  if (!bSuccess)
3806  {
3807  heap_free(task);
3809  }
3810  return ERROR_SUCCESS;
3811 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
Definition: internet.c:3759
static BOOLEAN bSuccess
Definition: drive.cpp:419
#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:1076
#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 710 of file internet.c.

711 {
712  proxyinfo_t wpi;
713 
714  if (INTERNET_LoadProxySettings( &wpi ))
715  return FALSE;
716 
717  if (wpi.proxyEnabled)
718  {
719  TRACE("http proxy = %s bypass = %s\n", debugstr_w(wpi.proxy), debugstr_w(wpi.proxyBypass));
720 
722  lpwai->proxy = wpi.proxy;
723  lpwai->proxyBypass = wpi.proxyBypass;
724  lpwai->proxyUsername = wpi.proxyUsername;
725  lpwai->proxyPassword = wpi.proxyPassword;
726  return TRUE;
727  }
728 
730  FreeProxyInfo(&wpi);
731  return FALSE;
732 }
#define TRUE
Definition: types.h:120
LPWSTR proxyBypass
Definition: internet.c:95
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
DWORD proxyEnabled
Definition: internet.c:93
LPWSTR proxyPassword
Definition: internet.c:97
LPWSTR proxyUsername
Definition: internet.h:296
#define debugstr_w
Definition: kernel32.h:32
DWORD accessType
Definition: internet.h:298
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:478
LPWSTR proxyUsername
Definition: internet.c:96
LPWSTR proxyPassword
Definition: internet.h:297
#define TRACE(s)
Definition: solgame.cpp:4
static LONG INTERNET_LoadProxySettings(proxyinfo_t *lpwpi)
Definition: internet.c:547
LPWSTR proxy
Definition: internet.h:294
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
LPWSTR proxy
Definition: internet.c:94
LPWSTR proxyBypass
Definition: internet.h:295

Referenced by InternetOpenW(), and query_global_option().

◆ INTERNET_FindProxyForProtocol()

WCHAR* INTERNET_FindProxyForProtocol ( LPCWSTR  szProxy,
LPCWSTR  proto 
)

Definition at line 392 of file internet.c.

393 {
394  WCHAR *ret = NULL;
395  const WCHAR *ptr;
396 
397  TRACE("(%s, %s)\n", debugstr_w(szProxy), debugstr_w(proto));
398 
399  /* First, look for the specified protocol (proto=scheme://host:port) */
400  for (ptr = szProxy; ptr && *ptr; )
401  {
402  LPCWSTR end, equal;
403 
404  if (!(end = strchrW(ptr, ' ')))
405  end = ptr + strlenW(ptr);
406  if ((equal = strchrW(ptr, '=')) && equal < end &&
407  equal - ptr == strlenW(proto) &&
409  {
410  ret = heap_strndupW(equal + 1, end - equal - 1);
411  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
412  return ret;
413  }
414  if (*end == ' ')
415  ptr = end + 1;
416  else
417  ptr = end;
418  }
419 
420  /* It wasn't found: look for no protocol */
421  for (ptr = szProxy; ptr && *ptr; )
422  {
423  LPCWSTR end;
424 
425  if (!(end = strchrW(ptr, ' ')))
426  end = ptr + strlenW(ptr);
427  if (!strchrW(ptr, '='))
428  {
429  ret = heap_strndupW(ptr, end - ptr);
430  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
431  return ret;
432  }
433  if (*end == ' ')
434  ptr = end + 1;
435  else
436  ptr = end;
437  }
438 
439  return NULL;
440 }
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define equal(x, y)
Definition: reader.cc:56
GLuint GLuint end
Definition: gl.h:1545
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret

Referenced by HTTP_DealWithProxy().

◆ INTERNET_GetLastError()

DWORD INTERNET_GetLastError ( void  )

Definition at line 3741 of file internet.c.

3742 {
3744  if (!lpwite) return 0;
3745  /* TlsGetValue clears last error, so set it again here */
3746  SetLastError(lpwite->dwError);
3747  return lpwite->dwError;
3748 }
DWORD dwError
Definition: internet.c:71
#define SetLastError(x)
Definition: compat.h:417
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:75

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 3820 of file internet.c.

3821 {
3823  if (!lpwite)
3824  lpwite = INTERNET_AllocThreadError();
3825  TRACE("\n");
3826  return lpwite->response;
3827 }
CHAR response[MAX_REPLY_LEN]
Definition: internet.c:72
#define TRACE(s)
Definition: solgame.cpp:4
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:3693
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:75

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

◆ INTERNET_GetSchemeString()

static LPCWSTR INTERNET_GetSchemeString ( INTERNET_SCHEME  scheme)
static

Definition at line 4085 of file internet.c.

4086 {
4087  int index;
4089  return NULL;
4091  if (index >= ARRAY_SIZE(url_schemes))
4092  return NULL;
4093  return (LPCWSTR)url_schemes[index];
4094 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD scheme
static const WCHAR url_schemes[][7]
Definition: internet.c:1597
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(a)
Definition: main.h:24

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 3485 of file internet.c.

3487 {
3488  URL_COMPONENTSW urlComponents = { sizeof(urlComponents) };
3489  WCHAR *host, *user = NULL, *pass = NULL, *path;
3490  HINTERNET client = NULL, client1 = NULL;
3491  DWORD res;
3492 
3493  TRACE("(%p, %s, %s, %08x, %08x, %08lx)\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
3494  dwHeadersLength, dwFlags, dwContext);
3495 
3496  urlComponents.dwHostNameLength = 1;
3497  urlComponents.dwUserNameLength = 1;
3498  urlComponents.dwPasswordLength = 1;
3499  urlComponents.dwUrlPathLength = 1;
3500  urlComponents.dwExtraInfoLength = 1;
3501  if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents))
3502  return NULL;
3503 
3504  if ((urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
3505  urlComponents.dwExtraInfoLength)
3506  {
3507  assert(urlComponents.lpszUrlPath + urlComponents.dwUrlPathLength == urlComponents.lpszExtraInfo);
3508  urlComponents.dwUrlPathLength += urlComponents.dwExtraInfoLength;
3509  }
3510 
3511  host = heap_strndupW(urlComponents.lpszHostName, urlComponents.dwHostNameLength);
3512  path = heap_strndupW(urlComponents.lpszUrlPath, urlComponents.dwUrlPathLength);
3513  if(urlComponents.dwUserNameLength)
3514  user = heap_strndupW(urlComponents.lpszUserName, urlComponents.dwUserNameLength);
3515  if(urlComponents.dwPasswordLength)
3516  pass = heap_strndupW(urlComponents.lpszPassword, urlComponents.dwPasswordLength);
3517 
3518  switch(urlComponents.nScheme) {
3519  case INTERNET_SCHEME_FTP:
3520  client = FTP_Connect(hIC, host, urlComponents.nPort,
3521  user, pass, dwFlags, dwContext, INET_OPENURL);
3522  if(client == NULL)
3523  break;
3524  client1 = FtpOpenFileW(client, path, GENERIC_READ, dwFlags, dwContext);
3525  if(client1 == NULL) {
3527  break;
3528  }
3529  break;
3530 
3531  case INTERNET_SCHEME_HTTP:
3532  case INTERNET_SCHEME_HTTPS: {
3533  static const WCHAR szStars[] = { '*','/','*', 0 };
3534  LPCWSTR accept[2] = { szStars, NULL };
3535 
3536  if (urlComponents.nScheme == INTERNET_SCHEME_HTTPS) dwFlags |= INTERNET_FLAG_SECURE;
3537 
3538  /* FIXME: should use pointers, not handles, as handles are not thread-safe */
3539  res = HTTP_Connect(hIC, host, urlComponents.nPort,
3540  user, pass, dwFlags, dwContext, INET_OPENURL, &client);
3541  if(res != ERROR_SUCCESS) {
3543  break;
3544  }
3545 
3546  client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
3547  if(client1 == NULL) {
3549  break;
3550  }
3551  HttpAddRequestHeadersW(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
3552  if (!HttpSendRequestW(client1, NULL, 0, NULL, 0) &&
3554  InternetCloseHandle(client1);
3555  client1 = NULL;
3556  break;
3557  }
3558  }
3560  /* gopher doesn't seem to be implemented in wine, but it's supposed
3561  * to be supported by InternetOpenUrlA. */
3562  default:
3564  break;
3565  }
3566 
3567  TRACE(" %p <--\n", client1);
3568 
3569  heap_free(host);
3570  heap_free(path);
3571  heap_free(user);
3572  heap_free(pass);
3573  return client1;
3574 }
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
void INTERNET_SetLastError(DWORD dwError)
Definition: internet.c:3720
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:1482
#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:1059
DWORD dwUserNameLength
Definition: wininet.h:219
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
#define ERROR_IO_PENDING
Definition: dderror.h:15
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
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5631
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:5872
#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:417
DWORD dwPasswordLength
Definition: wininet.h:221
DWORD dwHostNameLength
Definition: wininet.h:216
LPWSTR lpszUserName
Definition: wininet.h:218
_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:1396
#define GENERIC_READ
Definition: compat.h:124
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:244
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1644
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:3481
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:2425
DWORD dwExtraInfoLength
Definition: wininet.h:225

Referenced by AsyncInternetOpenUrlProc(), and InternetOpenUrlW().

◆ INTERNET_LoadProxySettings()

static LONG INTERNET_LoadProxySettings ( proxyinfo_t lpwpi)
static

Definition at line 547 of file internet.c.

548 {
549  HKEY key;
550  DWORD type, len;
551  LPCSTR envproxy;
552  LONG ret;
553 
554  memset( lpwpi, 0, sizeof(*lpwpi) );
555 
557  if (global_proxy)
558  {
560  lpwpi->proxy = heap_strdupW( global_proxy->proxy );
562  }
564 
566  {
567  FreeProxyInfo( lpwpi );
568  return ret;
569  }
570 
571  len = sizeof(DWORD);
572  if (RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&lpwpi->proxyEnabled, &len ) || type != REG_DWORD)
573  {
574  lpwpi->proxyEnabled = 0;
575  if((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE *)&lpwpi->proxyEnabled, sizeof(DWORD) )))
576  {
577  FreeProxyInfo( lpwpi );
578  RegCloseKey( key );
579  return ret;
580  }
581  }
582 
583  if (!(envproxy = getenv( "http_proxy" )) || lpwpi->proxyEnabled)
584  {
585  /* figure out how much memory the proxy setting takes */
586  if (!RegQueryValueExW( key, szProxyServer, NULL, &type, NULL, &len ) && len && (type == REG_SZ))
587  {
588  LPWSTR szProxy, p;
589  static const WCHAR szHttp[] = {'h','t','t','p','=',0};
590 
591  if (!(szProxy = heap_alloc(len)))
592  {
593  RegCloseKey( key );
594  FreeProxyInfo( lpwpi );
595  return ERROR_OUTOFMEMORY;
596  }
597  RegQueryValueExW( key, szProxyServer, NULL, &type, (BYTE*)szProxy, &len );
598 
599  /* find the http proxy, and strip away everything else */
600  p = strstrW( szProxy, szHttp );
601  if (p)
602  {
603  p += lstrlenW( szHttp );
604  lstrcpyW( szProxy, p );
605  }
606  p = strchrW( szProxy, ';' );
607  if (p) *p = 0;
608 
609  FreeProxyInfo( lpwpi );
610  lpwpi->proxy = szProxy;
611  lpwpi->proxyBypass = NULL;
612 
613  TRACE("http proxy (from registry) = %s\n", debugstr_w(lpwpi->proxy));
614  }
615  else
616  {
617  TRACE("No proxy server settings in registry.\n");
618  FreeProxyInfo( lpwpi );
619  lpwpi->proxy = NULL;
620  lpwpi->proxyBypass = NULL;
621  }
622  }
623  else if (envproxy)
624  {
625  WCHAR *envproxyW;
626 
627  len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
628  if (!(envproxyW = heap_alloc(len * sizeof(WCHAR))))
629  {
630  RegCloseKey( key );
631  return ERROR_OUTOFMEMORY;
632  }
633  MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
634 
635  FreeProxyInfo( lpwpi );
636  if (parse_proxy_url( lpwpi, envproxyW ))
637  {
638  TRACE("http proxy (from environment) = %s\n", debugstr_w(lpwpi->proxy));
639  lpwpi->proxyEnabled = 1;
640  lpwpi->proxyBypass = NULL;
641  }
642  else
643  {
644  WARN("failed to parse http_proxy value %s\n", debugstr_w(envproxyW));
645  lpwpi->proxyEnabled = 0;
646  lpwpi->proxy = NULL;
647  lpwpi->proxyBypass = NULL;
648  }
649  heap_free( envproxyW );
650  }
651 
652  if (lpwpi->proxyEnabled)
653  {
654  TRACE("Proxy is enabled.\n");
655 
656  if (!(envproxy = getenv( "no_proxy" )))
657  {
658  /* figure out how much memory the proxy setting takes */
659  if (!RegQueryValueExW( key, szProxyOverride, NULL, &type, NULL, &len ) && len && (type == REG_SZ))
660  {
661  LPWSTR szProxy;
662 
663  if (!(szProxy = heap_alloc(len)))
664  {
665  RegCloseKey( key );
666  return ERROR_OUTOFMEMORY;
667  }
668  RegQueryValueExW( key, szProxyOverride, NULL, &type, (BYTE*)szProxy, &len );
669 
670  heap_free( lpwpi->proxyBypass );
671  lpwpi->proxyBypass = szProxy;
672 
673  TRACE("http proxy bypass (from registry) = %s\n", debugstr_w(lpwpi->proxyBypass));
674  }
675  else
676  {
677  heap_free( lpwpi->proxyBypass );
678  lpwpi->proxyBypass = NULL;
679 
680  TRACE("No proxy bypass server settings in registry.\n");
681  }
682  }
683  else
684  {
685  WCHAR *envproxyW;
686 
687  len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
688  if (!(envproxyW = heap_alloc(len * sizeof(WCHAR))))
689  {
690  RegCloseKey( key );
691  return ERROR_OUTOFMEMORY;
692  }
693  MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
694 
695  heap_free( lpwpi->proxyBypass );
696  lpwpi->proxyBypass = envproxyW;
697 
698  TRACE("http proxy bypass (from environment) = %s\n", debugstr_w(lpwpi->proxyBypass));
699  }
700  }
701  else TRACE("Proxy is disabled.\n");
702 
703  RegCloseKey( key );
704  return ERROR_SUCCESS;
705 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szProxyEnable[]
Definition: internet.c:108
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static BOOL parse_proxy_url(proxyinfo_t *info, const WCHAR *url)
Definition: internet.c:499
LPWSTR proxyBypass
Definition: internet.c:95
#define WARN(fmt,...)
Definition: debug.h:111
static const WCHAR szProxyServer[]
Definition: internet.c:107
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD proxyEnabled
Definition: internet.c:93
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define lstrlenW
Definition: compat.h:415
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static DWORD
Definition: internet.c:33
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:486
#define strstrW(d, s)
Definition: unicode.h:32
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:478
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
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define CP_UNIXCP
Definition: compat.h:69
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static CRITICAL_SECTION WININET_cs
Definition: internet.c:78
static const WCHAR szInternetSettings[]
Definition: internet.c:103
int ret
HKEY key
Definition: reg.c:42
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
LPWSTR proxy
Definition: internet.c:94
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define lstrcpyW
Definition: compat.h:414
static const WCHAR szProxyOverride[]
Definition: internet.c:109
#define MultiByteToWideChar
Definition: compat.h:100
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
#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 339 of file internet.c.

340 {
341  HKEY key;
342  LONG ret;
343 
345  return ret;
346 
347  if ((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE*)&lpwpi->proxyEnabled, sizeof(DWORD))))
348  {
349  RegCloseKey( key );
350  return ret;
351  }
352 
353  if (lpwpi->proxy)
354  {
355  if ((ret = RegSetValueExW( key, szProxyServer, 0, REG_SZ, (BYTE*)lpwpi->proxy, sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1))))
356  {
357  RegCloseKey( key );
358  return ret;
359  }
360  }
361  else
362  {
364  {
365  RegCloseKey( key );
366  return ret;
367  }
368  }
369 
370  RegCloseKey(key);
371  return ERROR_SUCCESS;
372 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szProxyEnable[]
Definition: internet.c:108
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR szProxyServer[]
Definition: internet.c:107
DWORD proxyEnabled
Definition: internet.c:93
#define lstrlenW
Definition: compat.h:415
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:103
int ret
HKEY key
Definition: reg.c:42
unsigned char BYTE
Definition: mem.h:68
LPWSTR proxy
Definition: internet.c:94
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 3720 of file internet.c.

3721 {
3723 
3724  if (!lpwite)
3725  lpwite = INTERNET_AllocThreadError();
3726 
3727  SetLastError(dwError);
3728  if(lpwite)
3729  lpwite->dwError = dwError;
3730 }
DWORD dwError
Definition: internet.c:71
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:3693
#define SetLastError(x)
Definition: compat.h:417
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:75

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 3759 of file internet.c.

3760 {
3761  task_header_t *task = lpvParam;
3762 
3763  TRACE("\n");
3764 
3765  task->proc(task);
3766  WININET_Release(task->hdr);
3767  heap_free(task);
3768 
3770  {
3773  }
3774  return TRUE;
3775 }
#define TRUE
Definition: types.h:120
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1264
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
object_header_t * hdr
Definition: internet.h:391
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:219
async_task_proc_t proc
Definition: internet.h:390
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:75
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by INTERNET_AsyncCall().

◆ InternetAttemptConnect()

DWORD WINAPI InternetAttemptConnect ( DWORD  dwReserved)

Definition at line 1957 of file internet.c.

1958 {
1959  FIXME("Stub\n");
1960  return ERROR_SUCCESS;
1961 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:110

◆ InternetAutodial()

BOOL WINAPI InternetAutodial ( DWORD  dwFlags,
HWND  hwndParent 
)

Definition at line 3965 of file internet.c.

3966 {
3967  FIXME("STUB\n");
3968 
3969  /* Tell that we are connected to the internet. */
3970  return TRUE;
3971 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110

◆ InternetAutodialHangup()

BOOL WINAPI InternetAutodialHangup ( DWORD  dwReserved)

Definition at line 3985 of file internet.c.

3986 {
3987  FIXME("STUB\n");
3988 
3989  /* we didn't dial, we don't disconnect */
3990  return TRUE;
3991 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110

◆ InternetCanonicalizeUrlA()

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

Definition at line 2000 of file internet.c.

2002 {
2003  HRESULT hr;
2004 
2005  TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_a(lpszUrl), lpszBuffer,
2007 
2009  hr = UrlCanonicalizeA(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
2012 
2013  return hr == S_OK;
2014 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HRESULT hr
Definition: shlfolder.c:183
static DWORD convert_url_canonicalization_flags(DWORD dwFlags)
Definition: internet.c:1975
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:77
#define SetLastError(x)
Definition: compat.h:417
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59
_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 2026 of file internet.c.

2028 {
2029  HRESULT hr;
2030 
2031  TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_w(lpszUrl), lpszBuffer,
2033 
2035  hr = UrlCanonicalizeW(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
2038 
2039  return hr == S_OK;
2040 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HRESULT hr
Definition: shlfolder.c:183
static DWORD convert_url_canonicalization_flags(DWORD dwFlags)
Definition: internet.c:1975
#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:77
HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, LPDWORD pcchCanonicalized, DWORD dwFlags)
Definition: url.c:282
#define SetLastError(x)
Definition: compat.h:417
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59
_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 3459 of file internet.c.

3460 {
3461  WCHAR *url = NULL;
3462  BOOL rc;
3463 
3464  if(lpszUrl) {
3465  url = heap_strdupAtoW(lpszUrl);
3466  if(!url)
3467  return FALSE;
3468  }
3469 
3471 
3472  heap_free(url);
3473  return rc;
3474 }
_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
smooth NULL
Definition: ftsmooth.c:416
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:3343
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ InternetCheckConnectionW()

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

Definition at line 3343 of file internet.c.

3344 {
3345 /*
3346  * this is a kludge which runs the resident ping program and reads the output.
3347  *
3348  * Anyone have a better idea?
3349  */
3350 
3351  BOOL rc = FALSE;
3352  static const CHAR ping[] = "ping -c 1 ";
3353  static const CHAR redirect[] = " >/dev/null 2>/dev/null";
3354  WCHAR *host;
3355  DWORD len, host_len;
3357  int status = -1;
3358 
3359  FIXME("(%s %x %x)\n", debugstr_w(lpszUrl), dwFlags, dwReserved);
3360 
3361  /*
3362  * Crack or set the Address
3363  */
3364  if (lpszUrl == NULL)
3365  {
3366  /*
3367  * According to the doc we are supposed to use the ip for the next
3368  * server in the WnInet internal server database. I have
3369  * no idea what that is or how to get it.
3370  *
3371  * So someone needs to implement this.
3372  */
3373  FIXME("Unimplemented with URL of NULL\n");
3374  return TRUE;
3375  }
3376  else
3377  {
3379 
3381 
3382  if (!InternetCrackUrlW(lpszUrl,0,0,&components))
3383  goto End;
3384 
3385  host = components.lpszHostName;
3386  host_len = components.dwHostNameLength;
3387  port = components.nPort;
3388  TRACE("host name: %s port: %d\n",debugstr_wn(host, host_len), port);
3389  }
3390 
3392  {
3393  struct sockaddr_storage saddr;
3394  int sa_len = sizeof(saddr);
3395  WCHAR *host_z;
3396  int fd;
3397  BOOL b;
3398 
3399  host_z = heap_strndupW(host, host_len);
3400  if (!host_z)
3401  return FALSE;
3402 
3403  b = GetAddress(host_z, port, (struct sockaddr *)&saddr, &sa_len, NULL);
3404  heap_free(host_z);
3405  if(!b)
3406  goto End;
3407  init_winsock();
3408  fd = socket(saddr.ss_family, SOCK_STREAM, 0);
3409  if (fd != -1)
3410  {
3411  if (connect(fd, (struct sockaddr *)&saddr, sa_len) == 0)
3412  rc = TRUE;
3413  closesocket(fd);
3414  }
3415  }
3416  else
3417  {
3418  /*
3419  * Build our ping command
3420  */
3421  char *command;
3422 
3423  len = WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, NULL, 0, NULL, NULL);
3424  command = heap_alloc(strlen(ping)+len+strlen(redirect)+1);
3425  strcpy(command, ping);
3426  WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, command+sizeof(ping)-1, len, NULL, NULL);
3427  strcpy(command+sizeof(ping)-1+len, redirect);
3428 
3429  TRACE("Ping command is : %s\n",command);
3430 
3431  status = system(command);
3432  heap_free( command );
3433 
3434  TRACE("Ping returned a code of %i\n",status);
3435 
3436  /* Ping return code of 0 indicates success */
3437  if (status == 0)
3438  rc = TRUE;
3439  }
3440 
3441 End:
3442  if (rc == FALSE)
3444 
3445  return rc;
3446 }
#define TRUE
Definition: types.h:120
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:3720
#define WideCharToMultiByte
Definition: compat.h:101
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
char * host
Definition: whois.c:55
#define closesocket
Definition: precomp.h:57
static int fd
Definition: io.c:51
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
_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:110
smooth NULL
Definition: ftsmooth.c:416
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:69
__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
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:1644
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 1436 of file internet.c.

1437 {
1439 
1440  TRACE("%p\n", hInternet);
1441 
1442  obj = get_handle_object( hInternet );
1443  if (!obj) {
1445  return FALSE;
1446  }
1447 
1450 
1451  return TRUE;
1452 }
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
static void invalidate_handle(object_header_t *info)
Definition: internet.c:201
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:417
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:219
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:184

Referenced by _close_request(), 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_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 4004 of file internet.c.

4007 {
4008  HRESULT hr=S_OK;
4009 
4010  TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_a(lpszBaseUrl), debugstr_a(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4011 
4012  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4014  hr=UrlCombineA(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4015 
4016  return (hr==S_OK);
4017 }
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:77
#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:59
_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 4030 of file internet.c.

4033 {
4034  HRESULT hr=S_OK;
4035 
4036  TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(lpszBaseUrl), debugstr_w(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4037 
4038  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4040  hr=UrlCombineW(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4041 
4042  return (hr==S_OK);
4043 }
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:77
#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:59
_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 4435 of file internet.c.

4436 {
4437  FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_a(szUrlPrev), debugstr_a(szUrlNew), bPost);
4438  return ERROR_SUCCESS;
4439 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31

◆ InternetConfirmZoneCrossingW()

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

Definition at line 4445 of file internet.c.

4446 {
4447  FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_w(szUrlPrev), debugstr_w(szUrlNew), bPost);
4448  return ERROR_SUCCESS;
4449 }
#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:110

◆ 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 1343 of file internet.c.

1347 {
1348  HINTERNET rc = NULL;
1349  LPWSTR szServerName;
1350  LPWSTR szUserName;
1351  LPWSTR szPassword;
1352 
1353  szServerName = heap_strdupAtoW(lpszServerName);
1354  szUserName = heap_strdupAtoW(lpszUserName);
1355  szPassword = heap_strdupAtoW(lpszPassword);
1356 
1357  rc = InternetConnectW(hInternet, szServerName, nServerPort,
1358  szUserName, szPassword, dwService, dwFlags, dwContext);
1359 
1360  heap_free(szServerName);
1361  heap_free(szUserName);
1362  heap_free(szPassword);
1363  return rc;
1364 }
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2668
smooth NULL
Definition: ftsmooth.c:416
static WCHAR * heap_strdupAtoW(const char *str)
Definition: appwiz.h:80
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
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:1280
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_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 1280 of file internet.c.

1284 {
1285  appinfo_t *hIC;
1286  HINTERNET rc = NULL;
1288 
1289  TRACE("(%p, %s, %u, %s, %p, %u, %x, %lx)\n", hInternet, debugstr_w(lpszServerName),
1290  nServerPort, debugstr_w(lpszUserName), lpszPassword, dwService, dwFlags, dwContext);
1291 
1292  if (!lpszServerName)
1293  {
1295  return NULL;
1296  }
1297 
1298  hIC = (appinfo_t*)get_handle_object( hInternet );
1299  if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
1300  {
1302  goto lend;
1303  }
1304 
1305  switch (dwService)
1306  {
1307  case INTERNET_SERVICE_FTP:
1308  rc = FTP_Connect(hIC, lpszServerName, nServerPort,
1309  lpszUserName, lpszPassword, dwFlags, dwContext, 0);
1310  if(!rc)
1312  break;
1313 
1314  case INTERNET_SERVICE_HTTP:
1315  res = HTTP_Connect(hIC, lpszServerName, nServerPort,
1316  lpszUserName, lpszPassword, dwFlags, dwContext, 0, &rc);
1317  break;
1318 
1320  default:
1321  break;
1322  }
1323 lend:
1324  if( hIC )
1325  WININET_Release( &hIC->hdr );
1326 
1327  TRACE("returning %p\n", rc);
1328  SetLastError(res);
1329  return rc;
1330 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2668
#define INTERNET_SERVICE_GOPHER
Definition: wininet.h:561
#define debugstr_w
Definition: kernel32.h:32
DWORD INTERNET_GetLastError(void)
Definition: internet.c:3741
smooth NULL
Definition: ftsmooth.c:416
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:5872
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
#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:219
object_header_t hdr
Definition: internet.h:292
GLuint res
Definition: glext.h:9613
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
WH_TYPE htype
Definition: internet.h:274
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:184
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:2425

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 1528 of file internet.c.

1529 {
1530  WCHAR *host = NULL, *user = NULL, *pass = NULL, *path = NULL, *scheme = NULL, *extra = NULL;
1531  URL_COMPONENTSW comp;
1532  WCHAR *url_w = NULL;
1533  BOOL ret;
1534 
1535  TRACE("(%s %u %x %p)\n", url_length ? debugstr_an(url, url_length) : debugstr_a(url), url_length, flags, ret_comp);
1536 
1537  if (!url || !*url || !ret_comp || ret_comp->dwStructSize != sizeof(URL_COMPONENTSA)) {
1539  return FALSE;
1540  }
1541 
1542  comp.dwStructSize = sizeof(comp);
1543 
1545  &comp.lpszHostName, &comp.dwHostNameLength, &host)
1546  && set_url_component_AtoW(ret_comp->lpszUserName, ret_comp->dwUserNameLength,
1547  &comp.lpszUserName, &comp.dwUserNameLength, &user)
1548  && set_url_component_AtoW(ret_comp->lpszPassword, ret_comp->dwPasswordLength,
1549  &comp.lpszPassword, &comp.dwPasswordLength, &pass)
1550  && set_url_component_AtoW(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength,
1551  &comp.lpszUrlPath, &comp.dwUrlPathLength, &path)
1552  && set_url_component_AtoW(ret_comp->lpszScheme, ret_comp->dwSchemeLength,
1553  &comp.lpszScheme, &comp.dwSchemeLength, &scheme)
1554  && set_url_component_AtoW(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength,
1555  &comp.lpszExtraInfo, &comp.dwExtraInfoLength, &extra);
1556 
1557  if(ret && !(url_w = heap_strndupAtoW(url, url_length ? url_length : -1, &url_length))) {
1559  ret = FALSE;
1560  }
1561 
1562  if (ret && (ret = InternetCrackUrlW(url_w, url_length, flags, &comp))) {
1563  ret_comp->nScheme = comp.nScheme;
1564  ret_comp->nPort = comp.nPort;
1565 
1567  &ret_comp->lpszHostName, &ret_comp->dwHostNameLength, url)
1569  &ret_comp->lpszUserName, &ret_comp->dwUserNameLength, url)
1571  &ret_comp->lpszPassword, &ret_comp->dwPasswordLength, url)
1572  && set_url_component_WtoA(comp.lpszUrlPath, comp.dwUrlPathLength, url_w,
1573  &ret_comp->lpszUrlPath, &ret_comp->dwUrlPathLength, url)
1574  && set_url_component_WtoA(comp.lpszScheme, comp.dwSchemeLength, url_w,
1575  &ret_comp->lpszScheme, &ret_comp->dwSchemeLength, url)
1577  &ret_comp->lpszExtraInfo, &ret_comp->dwExtraInfoLength, url);
1578 
1579  if(ret)
1580  TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_a(url),
1581  debugstr_an(ret_comp->lpszScheme, ret_comp->dwSchemeLength),
1582  debugstr_an(ret_comp->lpszHostName, ret_comp->dwHostNameLength),
1583  debugstr_an(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength),
1584  debugstr_an(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength));
1585  }
1586 
1587  heap_free(host);
1588  heap_free(user);
1589  heap_free(pass);
1590  heap_free(path);
1591  heap_free(scheme);
1592  heap_free(extra);
1593  heap_free(url_w);
1594  return ret;
1595 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
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:1479
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
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
smooth NULL
Definition: ftsmooth.c:416
DWORD dwHostNameLength
Definition: wininet.h:198
#define TRACE(s)
Definition: solgame.cpp:4
Definition: id3.c:18
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:417
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:47
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
INTERNET_SCHEME nScheme
Definition: wininet.h:196
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1644
static BOOL set_url_component_AtoW(const char *comp_a, DWORD len_a, WCHAR **comp_w, DWORD *len_w, WCHAR **buf)
Definition: internet.c:1506
static WCHAR * heap_strndupAtoW(const char *str, int len_a, DWORD *len_w)
Definition: internet.h:150
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 1644 of file internet.c.

1645 {
1646  /*
1647  * RFC 1808
1648  * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
1649  *
1650  */
1651  LPCWSTR lpszParam = NULL;
1652  BOOL found_colon = FALSE;
1653  LPCWSTR lpszap;
1654  LPCWSTR lpszcp = NULL, lpszNetLoc;
1655 
1656  TRACE("(%s %u %x %p)\n",
1657  lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : strlenW(lpszUrl)) : "(null)",
1658  dwUrlLength, dwFlags, lpUC);
1659 
1660  if (!lpszUrl || !*lpszUrl || !lpUC)
1661  {
1663  return FALSE;
1664  }
1665  if (!dwUrlLength) dwUrlLength = strlenW(lpszUrl);
1666 
1667  if (dwFlags & ICU_DECODE)
1668  {
1669  WCHAR *url_tmp, *buffer;
1670  DWORD len = dwUrlLength + 1;
1671  BOOL ret;
1672 
1673  if (!(url_tmp = heap_strndupW(lpszUrl, dwUrlLength)))
1674  {
1676  return FALSE;
1677  }
1678 
1679  buffer = url_tmp;
1682  {
1683  buffer = heap_alloc(len * sizeof(WCHAR));
1684  if (!buffer)
1685  {
1687  heap_free(url_tmp);
1688  return FALSE;
1689  }
1691  }
1692  if (ret)
1694 
1695  if (buffer != url_tmp) heap_free(buffer);
1696  heap_free(url_tmp);
1697  return ret;
1698  }
1699  lpszap = lpszUrl;
1700 
1701  /* Determine if the URI is absolute. */
1702  while (lpszap - lpszUrl < dwUrlLength)
1703  {
1704  if (isalnumW(*lpszap) || *lpszap == '+' || *lpszap == '.' || *lpszap == '-')
1705  {
1706  lpszap++;
1707  continue;
1708  }
1709  if (*lpszap == ':')
1710  {
1711  found_colon = TRUE;
1712  lpszcp = lpszap;
1713  }
1714  else
1715  {
1716  lpszcp = lpszUrl; /* Relative url */
1717  }
1718 
1719  break;
1720  }
1721 
1722  if(!found_colon){
1724  return FALSE;
1725  }
1726 
1729 
1730  /* Parse <params> */
1731  lpszParam = memchrW(lpszap, '?', dwUrlLength - (lpszap - lpszUrl));
1732  if(!lpszParam)
1733  lpszParam = memchrW(lpszap, '#', dwUrlLength - (lpszap - lpszUrl));
1734 
1736  lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0))
1737  return FALSE;
1738 
1739 
1740  /* Get scheme first. */
1741  lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
1742  if(!set_url_component(&lpUC->lpszScheme, &lpUC->dwSchemeLength, lpszUrl, lpszcp - lpszUrl))
1743  return FALSE;
1744 
1745  /* Eat ':' in protocol. */
1746  lpszcp++;
1747 
1748  /* double slash indicates the net_loc portion is present */
1749  if ((lpszcp[0] == '/') && (lpszcp[1] == '/'))
1750  {
1751  lpszcp += 2;
1752 
1753  lpszNetLoc = memchrW(lpszcp, '/', dwUrlLength - (lpszcp - lpszUrl));
1754  if (lpszParam)
1755  {
1756  if (lpszNetLoc)
1757  lpszNetLoc = min(lpszNetLoc, lpszParam);
1758  else
1759  lpszNetLoc = lpszParam;
1760  }
1761  else if (!lpszNetLoc)
1762  lpszNetLoc = lpszcp + dwUrlLength-(lpszcp-lpszUrl);
1763 
1764  /* Parse net-loc */
1765  if (lpszNetLoc)
1766  {
1767  LPCWSTR lpszHost;
1768  LPCWSTR lpszPort;
1769 
1770  /* [<user>[<:password>]@]<host>[:<port>] */
1771  /* First find the user and password if they exist */
1772 
1773  lpszHost = memchrW(lpszcp, '@', dwUrlLength - (lpszcp - lpszUrl));
1774  if (lpszHost == NULL || lpszHost > lpszNetLoc)
1775  {
1776  /* username and password not specified. */
1779  }
1780  else /* Parse out username and password */
1781  {
1782  LPCWSTR lpszUser = lpszcp;
1783  LPCWSTR lpszPasswd = lpszHost;
1784 
1785  while (lpszcp < lpszHost)
1786  {
1787  if (*lpszcp == ':')
1788  lpszPasswd = lpszcp;
1789 
1790  lpszcp++;
1791  }
1792 
1793  if(!set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, lpszUser, lpszPasswd - lpszUser))
1794  return FALSE;
1795 
1796  if (lpszPasswd != lpszHost)
1797  lpszPasswd++;
1798  if(!set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength,
1799  lpszPasswd == lpszHost ? NULL : lpszPasswd, lpszHost - lpszPasswd))
1800  return FALSE;
1801 
1802  lpszcp++; /* Advance to beginning of host */
1803  }
1804 
1805  /* Parse <host><:port> */
1806 
1807  lpszHost = lpszcp;
1808  lpszPort = lpszNetLoc;
1809 
1810  /* special case for res:// URLs: there is no port here, so the host is the
1811  entire string up to the first '/' */
1812  if(lpUC->nScheme==INTERNET_SCHEME_RES)
1813  {
1814  if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
1815  return FALSE;
1816  lpszcp=lpszNetLoc;
1817  }
1818  else
1819  {
1820  while (lpszcp < lpszNetLoc)
1821  {
1822  if (*lpszcp == ':')
1823  lpszPort = lpszcp;
1824 
1825  lpszcp++;
1826  }
1827 
1828  /* If the scheme is "file" and the host is just one letter, it's not a host */
1829  if(lpUC->nScheme==INTERNET_SCHEME_FILE && lpszPort <= lpszHost+1)
1830  {
1831  lpszcp=lpszHost;
1833  }
1834  else
1835  {
1836  if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
1837  return FALSE;
1838  if (lpszPort != lpszNetLoc)
1839  lpUC->nPort = atoiW(++lpszPort);
1840  else switch (lpUC->nScheme)
1841  {
1842  case INTERNET_SCHEME_HTTP:
1844  break;
1845  case INTERNET_SCHEME_HTTPS:
1847  break;
1848  case INTERNET_SCHEME_FTP:
1850  break;
1853  break;
1854  default:
1855  break;
1856  }
1857  }
1858  }
1859  }
1860  }
1861  else
1862  {
1866  }
1867 
1868  /* Here lpszcp points to:
1869  *
1870  * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
1871  * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1872  */
1873  if (lpszcp != 0 && lpszcp - lpszUrl < dwUrlLength && (!lpszParam || lpszcp <= lpszParam))
1874  {
1875  DWORD len;
1876 
1877  /* Only truncate the parameter list if it's already been saved
1878  * in lpUC->lpszExtraInfo.
1879  */
1880  if (lpszParam && lpUC->dwExtraInfoLength && lpUC->lpszExtraInfo)
1881  len = lpszParam - lpszcp;
1882  else
1883  {
1884  /* Leave the parameter list in lpszUrlPath. Strip off any trailing
1885  * newlines if necessary.
1886  */
1887  LPWSTR lpsznewline = memchrW(lpszcp, '\n', dwUrlLength - (lpszcp - lpszUrl));
1888  if (lpsznewline != NULL)
1889  len = lpsznewline - lpszcp;
1890  else
1891  len = dwUrlLength-(lpszcp-lpszUrl);
1892  }
1893  if (lpUC->dwUrlPathLength && lpUC->lpszUrlPath &&
1894  lpUC->nScheme == INTERNET_SCHEME_FILE)
1895  {
1896  WCHAR tmppath[MAX_PATH];
1897  if (*lpszcp == '/')
1898  {
1899  len = MAX_PATH;
1900  PathCreateFromUrlW(lpszUrl, tmppath, &len, 0);
1901  }
1902  else
1903  {
1904  WCHAR *iter;
1905  memcpy(tmppath, lpszcp, len * sizeof(WCHAR));
1906  tmppath[len] = '\0';
1907 
1908  iter = tmppath;
1909  while (*iter) {
1910  if (*iter == '/')
1911  *iter = '\\';
1912  ++iter;
1913  }
1914  }
1915  /* if ends in \. or \.. append a backslash */
1916  if (tmppath[len - 1] == '.' &&
1917  (tmppath[len - 2] == '\\' ||
1918  (tmppath[len - 2] == '.' && tmppath[len - 3] == '\\')))
1919  {
1920  if (len < MAX_PATH - 1)
1921  {
1922  tmppath[len] = '\\';
1923  tmppath[len+1] = '\0';
1924  ++len;
1925  }
1926  }
1927  if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, tmppath, len))
1928  return FALSE;
1929  }
1930  else if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, len))
1931  return FALSE;
1932  }
1933  else
1934  {
1935  set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, 0);
1936  }
1937 
1938  TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_wn(lpszUrl,dwUrlLength),
1939  debugstr_wn(lpUC->lpszScheme,lpUC->dwSchemeLength),
1943 
1944  return TRUE;
1945 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3334
#define TRUE
Definition: types.h:120
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ERROR_INTERNET_UNRECOGNIZED_SCHEME
Definition: wininet.h:1995
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
DWORD dwUserNameLength
Definition: wininet.h:219
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2026
LPWSTR lpszHostName
Definition: wininet.h:215
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define INTERNET_INVALID_PORT_NUMBER
Definition: wininet.h:36
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
LPWSTR lpszExtraInfo
Definition: wininet.h:224
DWORD dwSchemeLength
Definition: wininet.h:213
INTERNET_PORT nPort
Definition: wininet.h:217
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
Definition: internet.c:1619
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR lpszScheme
Definition: wininet.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
INTERNET_SCHEME nScheme
Definition: wininet.h:214
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ICU_NO_ENCODE
Definition: winhttp.h:290
#define SetLastError(x)
Definition: compat.h:417
#define INTERNET_DEFAULT_FTP_PORT
Definition: wininet.h:38
DWORD dwPasswordLength
Definition: wininet.h:221
DWORD dwHostNameLength
Definition: wininet.h:216
int ret
LPWSTR lpszUserName
Definition: wininet.h:218
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPWSTR lpszUrlPath
Definition: wininet.h:222
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_wn
Definition: kernel32.h:33
WINE_UNICODE_INLINE int isalnumW(WCHAR wc)
Definition: unicode.h:190
DWORD dwUrlPathLength
Definition: wininet.h:223
#define INTERNET_DEFAULT_HTTPS_PORT
Definition: winhttp.h:37
#define min(a, b)
Definition: monoChain.cc:55
#define INTERNET_DEFAULT_GOPHER_PORT
Definition: wininet.h:39
static BOOL set_url_component(WCHAR **component, DWORD *component_length, const WCHAR *value, DWORD len)
Definition: internet.c:1454
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1644
#define ICU_DECODE
Definition: winhttp.h:291
WCHAR * LPWSTR
Definition: xmlstorage.h:184
WINE_UNICODE_INLINE WCHAR * memchrW(const WCHAR *ptr, WCHAR ch, size_t n)
Definition: unicode.h:295
LPWSTR lpszPassword
Definition: wininet.h:220
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
DWORD dwExtraInfoLength
Definition: wininet.h:225
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by cookie_parse_url(), CRYPT_CrackUrl(), CRYPT_GetRetrieveFunction(), File_RetrieveEncodedObjectW(), get_redirect_url(), get_url_components(), HTTP_DealWithProxy(), HTTP_HandleRedirect(), INTERNET_InternetOpenUrlW(), InternetCheckConnectionW(), InternetCrackUrlA(), InternetCrackUrlW_test(), InternetGetSecurityInfoByURLW(), parse_proxy_url(), test_crack_url(), CDownloadManager::ThreadFunc(), and urlcache_encode_url().

◆ InternetCreateUrlA()

BOOL WINAPI InternetCreateUrlA ( LPURL_COMPONENTSA  lpUrlComponents,
DWORD  dwFlags,
LPSTR  lpszUrl,
LPDWORD  lpdwUrlLength 
)

Definition at line 4243 of file internet.c.

4245 {
4246  BOOL ret;
4247  LPWSTR urlW = NULL;
4248  URL_COMPONENTSW urlCompW;
4249 
4250  TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
4251 
4252  if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
4253  {
4255  return FALSE;
4256  }
4257 
4258  convert_urlcomp_atow(lpUrlComponents, &urlCompW);
4259 
4260  if (lpszUrl)
4261  urlW = heap_alloc(*lpdwUrlLength * sizeof(WCHAR));
4262 
4263  ret = InternetCreateUrlW(&urlCompW, dwFlags, urlW, lpdwUrlLength);
4264 
4266  *lpdwUrlLength /= sizeof(WCHAR);
4267 
4268  /* on success, lpdwUrlLength points to the size of urlW in WCHARS
4269  * minus one, so add one to leave room for NULL terminator
4270  */
4271  if (ret)
4272  WideCharToMultiByte(CP_ACP, 0, urlW, -1, lpszUrl, *lpdwUrlLength + 1, NULL, NULL);
4273 
4274  heap_free(urlCompW.lpszScheme);
4275  heap_free(urlCompW.lpszHostName);
4276  heap_free(urlCompW.lpszUserName);
4277  heap_free(urlCompW.lpszPassword);
4278  heap_free(urlCompW.lpszUrlPath);
4279  heap_free(urlCompW.lpszExtraInfo);
4280  heap_free(urlW);
4281  return ret;
4282 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99