ReactOS  0.4.14-dev-52-g6116262
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 4049 of file internet.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 58 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 4051 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 4053 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 3780 of file internet.c.

3781 {
3782  task_header_t *task;
3783 
3784  task = heap_alloc(size);
3785  if(!task)
3786  return NULL;
3787 
3788  task->hdr = WININET_AddRef(hdr);
3789  task->proc = proc;
3790  return task;
3791 }
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:178
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 112 of file internet.c.

113 {
114  UINT_PTR handle = 0, num;
116  object_header_t **p;
117  BOOL res = TRUE;
118 
119  ret = heap_alloc_zero(size);
120  if(!ret)
121  return NULL;
122 
123  list_init(&ret->children);
124 
126 
127  if(!handle_table_size) {
128  num = 16;
129  p = heap_alloc_zero(sizeof(handle_table[0]) * num);
130  if(p) {
131  handle_table = p;
133  next_handle = 1;
134  }else {
135  res = FALSE;
136  }
137  }else if(next_handle == handle_table_size) {
138  num = handle_table_size * 2;
139  p = heap_realloc_zero(handle_table, sizeof(handle_table[0]) * num);
140  if(p) {
141  handle_table = p;
143  }else {
144  res = FALSE;
145  }
146  }
147 
148  if(res) {
150  if(handle_table[handle])
151  ERR("handle isn't free but should be\n");
153  ret->valid_handle = TRUE;
154 
156  next_handle++;
157  }
158 
160 
161  if(!res) {
162  heap_free(ret);
163  return NULL;
164  }
165 
166  ret->vtbl = vtbl;
167  ret->refs = 1;
168  ret->hInternet = (HINTERNET)handle;
169 
170  if(parent) {
171  ret->lpfnStatusCB = parent->lpfnStatusCB;
172  ret->dwInternalFlags = parent->dwInternalFlags & INET_CALLBACKW;
173  }
174 
175  return ret;
176 }
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:89
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2897
static UINT_PTR handle_table_size
Definition: internet.c:90
static CRITICAL_SECTION WININET_cs
Definition: internet.c:79
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 798 of file internet.c.

799 {
800  appinfo_t *lpwai = (appinfo_t*)hdr;
801 
802  TRACE("%p\n",lpwai);
803 
804  heap_free(lpwai->agent);
805  heap_free(lpwai->proxy);
806  heap_free(lpwai->proxyBypass);
807  heap_free(lpwai->proxyUsername);
808  heap_free(lpwai->proxyPassword);
809 }
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 811 of file internet.c.

812 {
813  appinfo_t *ai = (appinfo_t*)hdr;
814 
815  switch(option) {
817  TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
818 
819  if (*size < sizeof(ULONG))
821 
822  *size = sizeof(DWORD);
824  return ERROR_SUCCESS;
825 
827  DWORD bufsize;
828 
829  TRACE("INTERNET_OPTION_USER_AGENT\n");
830 
831  bufsize = *size;
832 
833  if (unicode) {
834  DWORD len = ai->agent ? strlenW(ai->agent) : 0;
835 
836  *size = (len + 1) * sizeof(WCHAR);
837  if(!buffer || bufsize < *size)
839 
840  if (ai->agent)
841  strcpyW(buffer, ai->agent);
842  else
843  *(WCHAR *)buffer = 0;
844  /* If the buffer is copied, the returned length doesn't include
845  * the NULL terminator.
846  */
847  *size = len;
848  }else {
849  if (ai->agent)
850  *size = WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, NULL, 0, NULL, NULL);
851  else
852  *size = 1;
853  if(!buffer || bufsize < *size)
855 
856  if (ai->agent)
857  WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, buffer, *size, NULL, NULL);
858  else
859  *(char *)buffer = 0;
860  /* If the buffer is copied, the returned length doesn't include
861  * the NULL terminator.
862  */
863  *size -= 1;
864  }
865 
866  return ERROR_SUCCESS;
867  }
868 
870  if(!size) return ERROR_INVALID_PARAMETER;
871  if (unicode) {
873  DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
874  LPWSTR proxy, proxy_bypass;
875 
876  if (ai->proxy)
877  proxyBytesRequired = (lstrlenW(ai->proxy) + 1) * sizeof(WCHAR);
878  if (ai->proxyBypass)
879  proxyBypassBytesRequired = (lstrlenW(ai->proxyBypass) + 1) * sizeof(WCHAR);
880  if (!pi || *size < sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired)
881  {
882  *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
884  }
886  proxy_bypass = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired);
887 
888  pi->dwAccessType = ai->accessType;
889  pi->lpszProxy = NULL;
890  pi->lpszProxyBypass = NULL;
891  if (ai->proxy) {
892  lstrcpyW(proxy, ai->proxy);
893  pi->lpszProxy = proxy;
894  }
895 
896  if (ai->proxyBypass) {
897  lstrcpyW(proxy_bypass, ai->proxyBypass);
898  pi->lpszProxyBypass = proxy_bypass;
899  }
900 
901  *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
902  return ERROR_SUCCESS;
903  }else {
905  DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
906  LPSTR proxy, proxy_bypass;
907 
908  if (ai->proxy)
909  proxyBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, NULL, 0, NULL, NULL);
910  if (ai->proxyBypass)
911  proxyBypassBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1,
912  NULL, 0, NULL, NULL);
913  if (!pi || *size < sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired)
914  {
915  *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
917  }
918  proxy = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA));
919  proxy_bypass = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired);
920 
921  pi->dwAccessType = ai->accessType;
922  pi->lpszProxy = NULL;
923  pi->lpszProxyBypass = NULL;
924  if (ai->proxy) {
925  WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, proxy, proxyBytesRequired, NULL, NULL);
926  pi->lpszProxy = proxy;
927  }
928 
929  if (ai->proxyBypass) {
930  WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1, proxy_bypass,
931  proxyBypassBytesRequired, NULL, NULL);
932  pi->lpszProxyBypass = proxy_bypass;
933  }
934 
935  *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
936  return ERROR_SUCCESS;
937  }
938 
940  TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
941 
942  if (*size < sizeof(ULONG))
944 
945  *(ULONG*)buffer = ai->connect_timeout;
946  *size = sizeof(ULONG);
947 
948  return ERROR_SUCCESS;
949  }
950 
951  return INET_QueryOption(hdr, option, buffer, size, unicode);
952 }
#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:407
#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:2533
#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
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR proxy
Definition: internet.h:294
static DWORD pi
Definition: protocol.c:150
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:406
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 954 of file internet.c.

955 {
956  appinfo_t *ai = (appinfo_t*)hdr;
957 
958  switch(option) {
960  TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
961 
962  if(size != sizeof(connect_timeout))
964  if(!*(ULONG*)buf)
965  return ERROR_BAD_ARGUMENTS;
966 
967  ai->connect_timeout = *(ULONG*)buf;
968  return ERROR_SUCCESS;
970  heap_free(ai->agent);
971  if (!(ai->agent = heap_strdupW(buf))) return ERROR_OUTOFMEMORY;
972  return ERROR_SUCCESS;
974  FIXME("INTERNET_OPTION_REFRESH\n");
975  return ERROR_SUCCESS;
976  }
977 
978  return INET_SetOption(hdr, option, buf, size);
979 }
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:2632
#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:102
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 3596 of file internet.c.

3597 {
3599 
3600  TRACE("%p\n", task->hdr.hdr);
3601 
3602  INTERNET_InternetOpenUrlW((appinfo_t*)task->hdr.hdr, task->url, task->headers,
3603  task->headers_len, task->flags, task->context);
3604  heap_free(task->url);
3605  heap_free(task->headers);
3606 }
char hdr[14]
Definition: iptest.cpp:33
DWORD headers_len
Definition: internet.c:3591
WCHAR * headers
Definition: internet.c:3590
#define TRACE(s)
Definition: solgame.cpp:4
object_header_t * hdr
Definition: internet.h:391
task_header_t hdr
Definition: internet.c:3588
static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3488
DWORD_PTR context
Definition: internet.c:3593
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 4102 of file internet.c.

4104 {
4105  INTERNET_SCHEME nScheme;
4106 
4107  *lpdwUrlLength = 0;
4108 
4109  if (lpUrlComponents->lpszScheme)
4110  {
4111  DWORD dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
4112  *lpdwUrlLength += dwLen;
4113  nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
4114  }
4115  else
4116  {
4117  LPCWSTR scheme;
4118 
4119  nScheme = lpUrlComponents->nScheme;
4120 
4121  if (nScheme == INTERNET_SCHEME_DEFAULT)
4122  nScheme = INTERNET_SCHEME_HTTP;
4123  scheme = INTERNET_GetSchemeString(nScheme);
4124  *lpdwUrlLength += strlenW(scheme);
4125  }
4126 
4127  (*lpdwUrlLength)++; /* ':' */
4128  if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
4129  *lpdwUrlLength += strlen("//");
4130 
4131  if (lpUrlComponents->lpszUserName)
4132  {
4133  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
4134  *lpdwUrlLength += strlen("@");
4135  }
4136  else
4137  {
4138  if (lpUrlComponents->lpszPassword)
4139  {
4141  return FALSE;
4142  }
4143  }
4144 
4145  if (lpUrlComponents->lpszPassword)
4146  {
4147  *lpdwUrlLength += strlen(":");
4148  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, Password);
4149  }
4150 
4151  if (lpUrlComponents->lpszHostName)
4152  {
4153  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
4154 
4155  if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
4156  {
4157  char szPort[MAX_WORD_DIGITS+1];
4158 
4159  *lpdwUrlLength += sprintf(szPort, "%d", lpUrlComponents->nPort);
4160  *lpdwUrlLength += strlen(":");
4161  }
4162 
4163  if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
4164  (*lpdwUrlLength)++; /* '/' */
4165  }
4166 
4167  if (lpUrlComponents->lpszUrlPath)
4168  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
4169 
4170  if (lpUrlComponents->lpszExtraInfo)
4171  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
4172 
4173  return TRUE;
4174 }
static BOOL url_uses_default_port(INTERNET_SCHEME nScheme, INTERNET_PORT nPort)
Definition: internet.c:4056
#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:3723
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:1620
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:4049
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:4051
LPWSTR lpszScheme
Definition: winhttp.h:466
static BOOL scheme_is_opaque(INTERNET_SCHEME nScheme)
Definition: internet.c:4079
static LPCWSTR INTERNET_GetSchemeString(INTERNET_SCHEME scheme)
Definition: internet.c:4088

Referenced by InternetCreateUrlW().

◆ convert_url_canonicalization_flags()

static DWORD convert_url_canonicalization_flags ( DWORD  dwFlags)
static

Definition at line 1976 of file internet.c.

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

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

3875 {
3876  req_file_t *req_file;
3877 
3878  req_file = heap_alloc_zero(sizeof(*req_file));
3879  if(!req_file)
3880  return ERROR_NOT_ENOUGH_MEMORY;
3881 
3882  req_file->ref = 1;
3883 
3884  req_file->file_name = heap_strdupW(file_name);
3885  if(!req_file->file_name) {
3886  heap_free(req_file);
3887  return ERROR_NOT_ENOUGH_MEMORY;
3888  }
3889 
3892  if(req_file->file_handle == INVALID_HANDLE_VALUE) {
3893  req_file_release(req_file);
3894  return GetLastError();
3895  }
3896 
3897  *ret = req_file;
3898  return ERROR_SUCCESS;
3899 }
void req_file_release(req_file_t *req_file)
Definition: internet.c:3901
#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:391
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:426
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
static LPCWSTR file_name
Definition: protocol.c:146
#define CreateFileW
Definition: compat.h:400
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 4576 of file internet.c.

4578 {
4579  FIXME("(%s, %s, %s, %p) stub\n", debugstr_w(pszChallengeInfo), debugstr_w(pwszRealm),
4580  debugstr_w(pwszTarget), pbHexHash);
4581  return FALSE;
4582 }
#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 471 of file internet.c.

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

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 326 of file internet.c.

327 {
328  FIXME("(%x %s): stub\n", bInstall, debugstr_w(cmdline));
329  return S_OK;
330 }
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 275 of file internet.c.

276 {
277  TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
278 
279  switch (fdwReason) {
280  case DLL_PROCESS_ATTACH:
281 
283 
285  return FALSE;
286 
287  if(!init_urlcache())
288  {
290  return FALSE;
291  }
292 
293  WININET_hModule = hinstDLL;
294  break;
295 
296  case DLL_THREAD_ATTACH:
297  break;
298 
299  case DLL_THREAD_DETACH:
301  {
303  }
304  break;
305 
306  case DLL_PROCESS_DETACH:
307  if (lpvReserved) break;
309  NETCON_unload();
310  free_urlcache();
311  free_cookie();
312 
314  {
317  }
318  break;
319  }
320  return TRUE;
321 }
#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:4054
HMODULE WININET_hModule
Definition: internet.c:77
#define DLL_PROCESS_DETACH
Definition: compat.h:119
#define TRACE(s)
Definition: solgame.cpp:4
BOOL init_urlcache(void) DECLSPEC_HIDDEN
Definition: urlcache.c:4036
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1154
BOOL collect_connections(collect_type_t collect_type)
Definition: http.c:313
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1088
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
static void free_cookie(cookie_t *cookie)
Definition: cookie.c:75
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
void NETCON_unload(void) DECLSPEC_HIDDEN
static DWORD g_dwTlsErrIndex
Definition: internet.c:76
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ dump_INTERNET_FLAGS()

static void dump_INTERNET_FLAGS ( DWORD  dwFlags)
static

Definition at line 744 of file internet.c.

745 {
746 #define FE(x) { x, #x }
747  static const wininet_flag_info flag[] = {
776  };
777 #undef FE
778  unsigned int i;
779 
780  for (i = 0; i < (sizeof(flag) / sizeof(flag[0])); i++) {
781  if (flag[i].val & dwFlags) {
782  TRACE(" %s", flag[i].name);
783  dwFlags &= ~flag[i].val;
784  }
785  }
786  if (dwFlags)
787  TRACE(" Unknown flags (%08x)\n", dwFlags);
788  else
789  TRACE("\n");
790 }
#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 INTERNET_FLAG_CACHE_IF_NET_FAIL
Definition: wininet.h:77
#define INTERNET_FLAG_NO_COOKIES
Definition: wininet.h:75
Definition: name.c:36
#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 489 of file internet.c.

490 {
492  if (global_proxy)
493  {
496  }
498 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static proxyinfo_t * global_proxy
Definition: internet.c:487
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:479
static CRITICAL_SECTION WININET_cs
Definition: internet.c:79
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 479 of file internet.c.

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

186 {
188  UINT_PTR handle = (UINT_PTR) hinternet;
189 
191 
194 
196 
197  TRACE("handle %ld -> %p\n", handle, info);
198 
199  return info;
200 }
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:178
#define TRACE(s)
Definition: solgame.cpp:4
static UINT_PTR handle_table_size
Definition: internet.c:90
static CRITICAL_SECTION WININET_cs
Definition: internet.c:79
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 2303 of file internet.c.

2304 {
2305 #if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
2306 
2307  CFDictionaryRef settings = CFNetworkCopySystemProxySettings();
2308  WCHAR *ret = NULL;
2309  SIZE_T len;
2310  const void *ref;
2311 
2312  if (!settings) return NULL;
2313 
2314  if (!(ref = CFDictionaryGetValue( settings, kCFNetworkProxiesProxyAutoConfigURLString )))
2315  {
2316  CFRelease( settings );
2317  return NULL;
2318  }
2319  len = CFStringGetLength( ref );
2320  if (len)
2321  ret = heap_alloc( (len+1) * sizeof(WCHAR) );
2322  if (ret)
2323  {
2324  CFStringGetCharacters( ref, CFRangeMake(0, len), ret );
2325  ret[len] = 0;
2326  }
2327  TRACE( "returning %s\n", debugstr_w(ret) );
2328  CFRelease( settings );
2329  return ret;
2330 #else
2331  static int once;
2332  if (!once++) FIXME( "no support on this platform\n" );
2333  return NULL;
2334 #endif
2335 }
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 1620 of file internet.c.

1621 {
1622  int i;
1623 
1624  TRACE("%s %d\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp);
1625 
1626  if(lpszScheme==NULL)
1627  return INTERNET_SCHEME_UNKNOWN;
1628 
1629  for (i = 0; i < sizeof(url_schemes)/sizeof(url_schemes[0]); i++)
1630  if (!strncmpiW(lpszScheme, url_schemes[i], nMaxCmp))
1631  return INTERNET_SCHEME_FIRST + i;
1632 
1633  return INTERNET_SCHEME_UNKNOWN;
1634 }
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
static const WCHAR url_schemes[][7]
Definition: internet.c:1598
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

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

2534 {
2535  switch(option) {
2537  if (!size)
2538  return ERROR_INVALID_PARAMETER;
2539 
2540  if (*size < sizeof(DWORD_PTR)) {
2541  *size = sizeof(DWORD_PTR);
2543  }
2544  if (!buffer)
2545  return ERROR_INVALID_PARAMETER;
2546 
2547  *(DWORD_PTR *)buffer = hdr->dwContext;
2548  *size = sizeof(DWORD_PTR);
2549  return ERROR_SUCCESS;
2550 
2552  WARN("INTERNET_OPTION_REQUEST_FLAGS\n");
2553  *size = sizeof(DWORD);
2555 
2558  WARN("Called on global option %u\n", option);
2560  }
2561 
2562  /* FIXME: we shouldn't call it here */
2563  return query_global_option(option, buffer, size, unicode);
2564 }
#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:2337
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 2632 of file internet.c.

2633 {
2634  switch(option) {
2636  FIXME("INTERNETOPTION_SETTINGS_CHANGED semi-stub\n");
2638  return ERROR_SUCCESS;
2640  WARN("Not settable option %u\n", option);
2644  WARN("Called on global option %u\n", option);
2648  }
2649 
2651 }
#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:313
#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 3696 of file internet.c.

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

3802 {
3803  BOOL bSuccess;
3804 
3805  TRACE("\n");
3806 
3808  if (!bSuccess)
3809  {
3810  heap_free(task);
3812  }
3813  return ERROR_SUCCESS;
3814 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
Definition: internet.c:3762
static BOOLEAN bSuccess
Definition: drive.cpp:417
#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 711 of file internet.c.

712 {
713  proxyinfo_t wpi;
714 
715  if (INTERNET_LoadProxySettings( &wpi ))
716  return FALSE;
717 
718  if (wpi.proxyEnabled)
719  {
720  TRACE("http proxy = %s bypass = %s\n", debugstr_w(wpi.proxy), debugstr_w(wpi.proxyBypass));
721 
723  lpwai->proxy = wpi.proxy;
724  lpwai->proxyBypass = wpi.proxyBypass;
725  lpwai->proxyUsername = wpi.proxyUsername;
726  lpwai->proxyPassword = wpi.proxyPassword;
727  return TRUE;
728  }
729 
731  FreeProxyInfo(&wpi);
732  return FALSE;
733 }
#define TRUE
Definition: types.h:120
LPWSTR proxyBypass
Definition: internet.c:96
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
DWORD proxyEnabled
Definition: internet.c:94
LPWSTR proxyPassword
Definition: internet.c:98
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:479
LPWSTR proxyUsername
Definition: internet.c:97
LPWSTR proxyPassword
Definition: internet.h:297
#define TRACE(s)
Definition: solgame.cpp:4
static LONG INTERNET_LoadProxySettings(proxyinfo_t *lpwpi)
Definition: internet.c:548
LPWSTR proxy
Definition: internet.h:294
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
LPWSTR proxy
Definition: internet.c:95
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 393 of file internet.c.

394 {
395  WCHAR *ret = NULL;
396  const WCHAR *ptr;
397 
398  TRACE("(%s, %s)\n", debugstr_w(szProxy), debugstr_w(proto));
399 
400  /* First, look for the specified protocol (proto=scheme://host:port) */
401  for (ptr = szProxy; ptr && *ptr; )
402  {
403  LPCWSTR end, equal;
404 
405  if (!(end = strchrW(ptr, ' ')))
406  end = ptr + strlenW(ptr);
407  if ((equal = strchrW(ptr, '=')) && equal < end &&
408  equal - ptr == strlenW(proto) &&
410  {
411  ret = heap_strndupW(equal + 1, end - equal - 1);
412  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
413  return ret;
414  }
415  if (*end == ' ')
416  ptr = end + 1;
417  else
418  ptr = end;
419  }
420 
421  /* It wasn't found: look for no protocol */
422  for (ptr = szProxy; ptr && *ptr; )
423  {
424  LPCWSTR end;
425 
426  if (!(end = strchrW(ptr, ' ')))
427  end = ptr + strlenW(ptr);
428  if (!strchrW(ptr, '='))
429  {
430  ret = heap_strndupW(ptr, end - ptr);
431  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
432  return ret;
433  }
434  if (*end == ' ')
435  ptr = end + 1;
436  else
437  ptr = end;
438  }
439 
440  return NULL;
441 }
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 3744 of file internet.c.

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

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

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

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

◆ INTERNET_GetSchemeString()

static LPCWSTR INTERNET_GetSchemeString ( INTERNET_SCHEME  scheme)
static

Definition at line 4088 of file internet.c.

4089 {
4090  int index;
4092  return NULL;
4094  if (index >= sizeof(url_schemes)/sizeof(url_schemes[0]))
4095  return NULL;
4096  return (LPCWSTR)url_schemes[index];
4097 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD scheme
static const WCHAR url_schemes[][7]
Definition: internet.c:1598
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29

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

3490 {
3491  URL_COMPONENTSW urlComponents = { sizeof(urlComponents) };
3492  WCHAR *host, *user = NULL, *pass = NULL, *path;
3493  HINTERNET client = NULL, client1 = NULL;
3494  DWORD res;
3495 
3496  TRACE("(%p, %s, %s, %08x, %08x, %08lx)\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
3497  dwHeadersLength, dwFlags, dwContext);
3498 
3499  urlComponents.dwHostNameLength = 1;
3500  urlComponents.dwUserNameLength = 1;
3501  urlComponents.dwPasswordLength = 1;
3502  urlComponents.dwUrlPathLength = 1;
3503  urlComponents.dwExtraInfoLength = 1;
3504  if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents))
3505  return NULL;
3506 
3507  if ((urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
3508  urlComponents.dwExtraInfoLength)
3509  {
3510  assert(urlComponents.lpszUrlPath + urlComponents.dwUrlPathLength == urlComponents.lpszExtraInfo);
3511  urlComponents.dwUrlPathLength += urlComponents.dwExtraInfoLength;
3512  }
3513 
3514  host = heap_strndupW(urlComponents.lpszHostName, urlComponents.dwHostNameLength);
3515  path = heap_strndupW(urlComponents.lpszUrlPath, urlComponents.dwUrlPathLength);
3516  if(urlComponents.dwUserNameLength)
3517  user = heap_strndupW(urlComponents.lpszUserName, urlComponents.dwUserNameLength);
3518  if(urlComponents.dwPasswordLength)
3519  pass = heap_strndupW(urlComponents.lpszPassword, urlComponents.dwPasswordLength);
3520 
3521  switch(urlComponents.nScheme) {
3522  case INTERNET_SCHEME_FTP:
3523  client = FTP_Connect(hIC, host, urlComponents.nPort,
3524  user, pass, dwFlags, dwContext, INET_OPENURL);
3525  if(client == NULL)
3526  break;
3527  client1 = FtpOpenFileW(client, path, GENERIC_READ, dwFlags, dwContext);
3528  if(client1 == NULL) {
3530  break;
3531  }
3532  break;
3533 
3534  case INTERNET_SCHEME_HTTP:
3535  case INTERNET_SCHEME_HTTPS: {
3536  static const WCHAR szStars[] = { '*','/','*', 0 };
3537  LPCWSTR accept[2] = { szStars, NULL };
3538 
3539  if (urlComponents.nScheme == INTERNET_SCHEME_HTTPS) dwFlags |= INTERNET_FLAG_SECURE;
3540 
3541  /* FIXME: should use pointers, not handles, as handles are not thread-safe */
3542  res = HTTP_Connect(hIC, host, urlComponents.nPort,
3543  user, pass, dwFlags, dwContext, INET_OPENURL, &client);
3544  if(res != ERROR_SUCCESS) {
3546  break;
3547  }
3548 
3549  client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
3550  if(client1 == NULL) {
3552  break;
3553  }
3554  HttpAddRequestHeadersW(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
3555  if (!HttpSendRequestW(client1, NULL, 0, NULL, 0) &&
3557  InternetCloseHandle(client1);
3558  client1 = NULL;
3559  break;
3560  }
3561  }
3563  /* gopher doesn't seem to be implemented in wine, but it's supposed
3564  * to be supported by InternetOpenUrlA. */
3565  default:
3567  break;
3568  }
3569 
3570  TRACE(" %p <--\n", client1);
3571 
3572  heap_free(host);
3573  heap_free(path);
3574  heap_free(user);
3575  heap_free(pass);
3576  return client1;
3577 }
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:3723
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:1437
#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:5565
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:5806
#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:409
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:1354
#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
Definition: services.c:325
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1645
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:3419
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 548 of file internet.c.

549 {
550  HKEY key;
551  DWORD type, len;
552  LPCSTR envproxy;
553  LONG ret;
554 
555  memset( lpwpi, 0, sizeof(*lpwpi) );
556 
558  if (global_proxy)
559  {
561  lpwpi->proxy = heap_strdupW( global_proxy->proxy );
563  }
565 
567  {
568  FreeProxyInfo( lpwpi );
569  return ret;
570  }
571 
572  len = sizeof(DWORD);
573  if (RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&lpwpi->proxyEnabled, &len ) || type != REG_DWORD)
574  {
575  lpwpi->proxyEnabled = 0;
576  if((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE *)&lpwpi->proxyEnabled, sizeof(DWORD) )))
577  {
578  FreeProxyInfo( lpwpi );
579  RegCloseKey( key );
580  return ret;
581  }
582  }
583 
584  if (!(envproxy = getenv( "http_proxy" )) || lpwpi->proxyEnabled)
585  {
586  /* figure out how much memory the proxy setting takes */
587  if (!RegQueryValueExW( key, szProxyServer, NULL, &type, NULL, &len ) && len && (type == REG_SZ))
588  {
589  LPWSTR szProxy, p;
590  static const WCHAR szHttp[] = {'h','t','t','p','=',0};
591 
592  if (!(szProxy = heap_alloc(len)))
593  {
594  RegCloseKey( key );
595  FreeProxyInfo( lpwpi );
596  return ERROR_OUTOFMEMORY;
597  }
598  RegQueryValueExW( key, szProxyServer, NULL, &type, (BYTE*)szProxy, &len );
599 
600  /* find the http proxy, and strip away everything else */
601  p = strstrW( szProxy, szHttp );
602  if (p)
603  {
604  p += lstrlenW( szHttp );
605  lstrcpyW( szProxy, p );
606  }
607  p = strchrW( szProxy, ';' );
608  if (p) *p = 0;
609 
610  FreeProxyInfo( lpwpi );
611  lpwpi->proxy = szProxy;
612  lpwpi->proxyBypass = NULL;
613 
614  TRACE("http proxy (from registry) = %s\n", debugstr_w(lpwpi->proxy));
615  }
616  else
617  {
618  TRACE("No proxy server settings in registry.\n");
619  FreeProxyInfo( lpwpi );
620  lpwpi->proxy = NULL;
621  lpwpi->proxyBypass = NULL;
622  }
623  }
624  else if (envproxy)
625  {
626  WCHAR *envproxyW;
627 
628  len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
629  if (!(envproxyW = heap_alloc(len * sizeof(WCHAR))))
630  {
631  RegCloseKey( key );
632  return ERROR_OUTOFMEMORY;
633  }
634  MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
635 
636  FreeProxyInfo( lpwpi );
637  if (parse_proxy_url( lpwpi, envproxyW ))
638  {
639  TRACE("http proxy (from environment) = %s\n", debugstr_w(lpwpi->proxy));
640  lpwpi->proxyEnabled = 1;
641  lpwpi->proxyBypass = NULL;
642  }
643  else
644  {
645  WARN("failed to parse http_proxy value %s\n", debugstr_w(envproxyW));
646  lpwpi->proxyEnabled = 0;
647  lpwpi->proxy = NULL;
648  lpwpi->proxyBypass = NULL;
649  }
650  heap_free( envproxyW );
651  }
652 
653  if (lpwpi->proxyEnabled)
654  {
655  TRACE("Proxy is enabled.\n");
656 
657  if (!(envproxy = getenv( "no_proxy" )))
658  {
659  /* figure out how much memory the proxy setting takes */
660  if (!RegQueryValueExW( key, szProxyOverride, NULL, &type, NULL, &len ) && len && (type == REG_SZ))
661  {
662  LPWSTR szProxy;
663 
664  if (!(szProxy = heap_alloc(len)))
665  {
666  RegCloseKey( key );
667  return ERROR_OUTOFMEMORY;
668  }
669  RegQueryValueExW( key, szProxyOverride, NULL, &type, (BYTE*)szProxy, &len );
670 
671  heap_free( lpwpi->proxyBypass );
672  lpwpi->proxyBypass = szProxy;
673 
674  TRACE("http proxy bypass (from registry) = %s\n", debugstr_w(lpwpi->proxyBypass));
675  }
676  else
677  {
678  heap_free( lpwpi->proxyBypass );
679  lpwpi->proxyBypass = NULL;
680 
681  TRACE("No proxy bypass server settings in registry.\n");
682  }
683  }
684  else
685  {
686  WCHAR *envproxyW;
687 
688  len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
689  if (!(envproxyW = heap_alloc(len * sizeof(WCHAR))))
690  {
691  RegCloseKey( key );
692  return ERROR_OUTOFMEMORY;
693  }
694  MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
695 
696  heap_free( lpwpi->proxyBypass );
697  lpwpi->proxyBypass = envproxyW;
698 
699  TRACE("http proxy bypass (from environment) = %s\n", debugstr_w(lpwpi->proxyBypass));
700  }
701  }
702  else TRACE("Proxy is disabled.\n");
703 
704  RegCloseKey( key );
705  return ERROR_SUCCESS;
706 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szProxyEnable[]
Definition: internet.c:109
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:500
LPWSTR proxyBypass
Definition: internet.c:96
#define WARN(fmt,...)
Definition: debug.h:111
static const WCHAR szProxyServer[]
Definition: internet.c:108
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD proxyEnabled
Definition: internet.c:94
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define lstrlenW
Definition: compat.h:407
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:487
#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:479
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:79
static const WCHAR szInternetSettings[]
Definition: internet.c:104
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:95
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define lstrcpyW
Definition: compat.h:406
static const WCHAR szProxyOverride[]
Definition: internet.c:110
#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:42
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 340 of file internet.c.

341 {
342  HKEY key;
343  LONG ret;
344 
346  return ret;
347 
348  if ((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE*)&lpwpi->proxyEnabled, sizeof(DWORD))))
349  {
350  RegCloseKey( key );
351  return ret;
352  }
353 
354  if (lpwpi->proxy)
355  {
356  if ((ret = RegSetValueExW( key, szProxyServer, 0, REG_SZ, (BYTE*)lpwpi->proxy, sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1))))
357  {
358  RegCloseKey( key );
359  return ret;
360  }
361  }
362  else
363  {
365  {
366  RegCloseKey( key );
367  return ret;
368  }
369  }
370 
371  RegCloseKey(key);
372  return ERROR_SUCCESS;
373 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szProxyEnable[]
Definition: internet.c:109
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR szProxyServer[]
Definition: internet.c:108
DWORD proxyEnabled
Definition: internet.c:94
#define lstrlenW
Definition: compat.h:407
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:104
int ret
HKEY key
Definition: reg.c:42
unsigned char BYTE
Definition: mem.h:68
LPWSTR proxy
Definition: internet.c:95
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
#define REG_DWORD
Definition: sdbapi.c:596
Definition: path.c:42
#define REG_SZ
Definition: layer.c:22

Referenced by InternetSetOptionW().

◆ INTERNET_SetLastError()

void INTERNET_SetLastError ( DWORD  dwError)

Definition at line 3723 of file internet.c.

3724 {
3726 
3727  if (!lpwite)
3728  lpwite = INTERNET_AllocThreadError();
3729 
3730  SetLastError(dwError);
3731  if(lpwite)
3732  lpwite->dwError = dwError;
3733 }
DWORD dwError
Definition: internet.c:72
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:3696
#define SetLastError(x)
Definition: compat.h:409
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:76

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

3763 {
3764  task_header_t *task = lpvParam;
3765 
3766  TRACE("\n");
3767 
3768  task->proc(task);
3769  WININET_Release(task->hdr);
3770  heap_free(task);
3771 
3773  {
3776  }
3777  return TRUE;
3778 }
#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:220
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:76
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by INTERNET_AsyncCall().

◆ InternetAttemptConnect()

DWORD WINAPI InternetAttemptConnect ( DWORD  dwReserved)

Definition at line 1958 of file internet.c.

1959 {
1960  FIXME("Stub\n");
1961  return ERROR_SUCCESS;
1962 }
#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 3968 of file internet.c.

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

◆ InternetAutodialHangup()

BOOL WINAPI InternetAutodialHangup ( DWORD  dwReserved)

Definition at line 3988 of file internet.c.

3989 {
3990  FIXME("STUB\n");
3991 
3992  /* we didn't dial, we don't disconnect */
3993  return TRUE;
3994 }
#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 2001 of file internet.c.

2003 {
2004  HRESULT hr;
2005 
2006  TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_a(lpszUrl), lpszBuffer,
2008 
2010  hr = UrlCanonicalizeA(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
2013 
2014  return hr == S_OK;
2015 }
#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:1976
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:409
_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 2027 of file internet.c.

2029 {
2030  HRESULT hr;
2031 
2032  TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_w(lpszUrl), lpszBuffer,
2034 
2036  hr = UrlCanonicalizeW(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
2039 
2040  return hr == S_OK;
2041 }
#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:1976
#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:409
_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 3462 of file internet.c.

3463 {
3464  WCHAR *url = NULL;
3465  BOOL rc;
3466 
3467  if(lpszUrl) {
3468  url = heap_strdupAtoW(lpszUrl);
3469  if(!url)
3470  return FALSE;
3471  }
3472 
3474 
3475  heap_free(url);
3476  return rc;
3477 }
_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:3346
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ InternetCheckConnectionW()

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

Definition at line 3346 of file internet.c.

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

1438 {
1440 
1441  TRACE("%p\n", hInternet);
1442 
1443  obj = get_handle_object( hInternet );
1444  if (!obj) {
1446  return FALSE;
1447  }
1448 
1451 
1452  return TRUE;
1453 }
#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:202
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:220
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:185

Referenced by _close_request(), can_do_https(), close_async_handle(), CRYPT_Connect(), get_internet_session(), http_get(), http_post(), 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_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 4007 of file internet.c.

4010 {
4011  HRESULT hr=S_OK;
4012 
4013  TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_a(lpszBaseUrl), debugstr_a(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4014 
4015  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4017  hr=UrlCombineA(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4018 
4019  return (hr==S_OK);
4020 }
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 4033 of file internet.c.

4036 {
4037  HRESULT hr=S_OK;
4038 
4039  TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(lpszBaseUrl), debugstr_w(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4040 
4041  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4043  hr=UrlCombineW(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4044 
4045  return (hr==S_OK);
4046 }
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 4438 of file internet.c.

4439 {
4440  FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_a(szUrlPrev), debugstr_a(szUrlNew), bPost);
4441  return ERROR_SUCCESS;
4442 }
#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 4448 of file internet.c.

4449 {
4450  FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_w(szUrlPrev), debugstr_w(szUrlNew), bPost);
4451  return ERROR_SUCCESS;
4452 }
#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 1344 of file internet.c.

1348 {
1349  HINTERNET rc = NULL;
1350  LPWSTR szServerName;
1351  LPWSTR szUserName;
1352  LPWSTR szPassword;
1353 
1354  szServerName = heap_strdupAtoW(lpszServerName);
1355  szUserName = heap_strdupAtoW(lpszUserName);
1356  szPassword = heap_strdupAtoW(lpszPassword);
1357 
1358  rc = InternetConnectW(hInternet, szServerName, nServerPort,
1359  szUserName, szPassword, dwService, dwFlags, dwContext);
1360 
1361  heap_free(szServerName);
1362  heap_free(szUserName);
1363  heap_free(szPassword);
1364  return rc;
1365 }
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2651
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:1281
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_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 1281 of file internet.c.

1285 {
1286  appinfo_t *hIC;
1287  HINTERNET rc = NULL;
1289 
1290  TRACE("(%p, %s, %u, %s, %p, %u, %x, %lx)\n", hInternet, debugstr_w(lpszServerName),
1291  nServerPort, debugstr_w(lpszUserName), lpszPassword, dwService, dwFlags, dwContext);
1292 
1293  if (!lpszServerName)
1294  {
1296  return NULL;
1297  }
1298 
1299  hIC = (appinfo_t*)get_handle_object( hInternet );
1300  if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
1301  {
1303  goto lend;
1304  }
1305 
1306  switch (dwService)
1307  {
1308  case INTERNET_SERVICE_FTP:
1309  rc = FTP_Connect(hIC, lpszServerName, nServerPort,
1310  lpszUserName, lpszPassword, dwFlags, dwContext, 0);
1311  if(!rc)
1313  break;
1314 
1315  case INTERNET_SERVICE_HTTP:
1316  res = HTTP_Connect(hIC, lpszServerName, nServerPort,
1317  lpszUserName, lpszPassword, dwFlags, dwContext, 0, &rc);
1318  break;
1319 
1321  default:
1322  break;
1323  }
1324 lend:
1325  if( hIC )
1326  WININET_Release( &hIC->hdr );
1327 
1328  TRACE("returning %p\n", rc);
1329  SetLastError(res);
1330  return rc;
1331 }
#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:2651
#define INTERNET_SERVICE_GOPHER
Definition: wininet.h:561
#define debugstr_w
Definition: kernel32.h:32
DWORD INTERNET_GetLastError(void)
Definition: internet.c:3744
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:5806
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#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:220
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:185
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 1529 of file internet.c.

1530 {
1531  WCHAR *host = NULL, *user = NULL, *pass = NULL, *path = NULL, *scheme = NULL, *extra = NULL;
1532  URL_COMPONENTSW comp;
1533  WCHAR *url_w = NULL;
1534  BOOL ret;
1535 
1536  TRACE("(%s %u %x %p)\n", url_length ? debugstr_an(url, url_length) : debugstr_a(url), url_length, flags, ret_comp);
1537 
1538  if (!url || !*url || !ret_comp || ret_comp->dwStructSize != sizeof(URL_COMPONENTSA)) {
1540  return FALSE;
1541  }
1542 
1543  comp.dwStructSize = sizeof(comp);
1544 
1546  &comp.lpszHostName, &comp.dwHostNameLength, &host)
1547  && set_url_component_AtoW(ret_comp->lpszUserName, ret_comp->dwUserNameLength,
1548  &comp.lpszUserName, &comp.dwUserNameLength, &user)
1549  && set_url_component_AtoW(ret_comp->lpszPassword, ret_comp->dwPasswordLength,
1550  &comp.lpszPassword, &comp.dwPasswordLength, &pass)
1551  && set_url_component_AtoW(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength,
1552  &comp.lpszUrlPath, &comp.dwUrlPathLength, &path)
1553  && set_url_component_AtoW(ret_comp->lpszScheme, ret_comp->dwSchemeLength,
1554  &comp.lpszScheme, &comp.dwSchemeLength, &scheme)
1555  && set_url_component_AtoW(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength,
1556  &comp.lpszExtraInfo, &comp.dwExtraInfoLength, &extra);
1557 
1558  if(ret && !(url_w = heap_strndupAtoW(url, url_length ? url_length : -1, &url_length))) {
1560  ret = FALSE;
1561  }
1562 
1563  if (ret && (ret = InternetCrackUrlW(url_w, url_length, flags, &comp))) {
1564  ret_comp->nScheme = comp.nScheme;
1565  ret_comp->nPort = comp.nPort;
1566 
1568  &ret_comp->lpszHostName, &ret_comp->dwHostNameLength, url)
1570  &ret_comp->lpszUserName, &ret_comp->dwUserNameLength, url)
1572  &ret_comp->lpszPassword, &ret_comp->dwPasswordLength, url)
1573  && set_url_component_WtoA(comp.lpszUrlPath, comp.dwUrlPathLength, url_w,
1574  &ret_comp->lpszUrlPath, &ret_comp->dwUrlPathLength, url)
1575  && set_url_component_WtoA(comp.lpszScheme, comp.dwSchemeLength, url_w,
1576  &ret_comp->lpszScheme, &ret_comp->dwSchemeLength, url)
1578  &ret_comp->lpszExtraInfo, &ret_comp->dwExtraInfoLength, url);
1579 
1580  if(ret)
1581  TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_a(url),
1582  debugstr_an(ret_comp->lpszScheme, ret_comp->dwSchemeLength),
1583  debugstr_an(ret_comp->lpszHostName, ret_comp->dwHostNameLength),
1584  debugstr_an(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength),
1585  debugstr_an(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength));
1586  }
1587 
1588  heap_free(host);
1589  heap_free(user);
1590  heap_free(pass);
1591  heap_free(path);
1592  heap_free(scheme);
1593  heap_free(extra);
1594  heap_free(url_w);
1595  return ret;
1596 }
#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:1480
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:409
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
Definition: services.c:325
INTERNET_SCHEME nScheme
Definition: wininet.h:196
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1645
static BOOL set_url_component_AtoW(const char *comp_a, DWORD len_a, WCHAR **comp_w, DWORD *len_w, WCHAR **buf)
Definition: internet.c:1507
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 1645 of file internet.c.

1646 {
1647  /*
1648  * RFC 1808
1649  * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
1650  *
1651  */
1652  LPCWSTR lpszParam = NULL;
1653  BOOL found_colon = FALSE;
1654  LPCWSTR lpszap;
1655  LPCWSTR lpszcp = NULL, lpszNetLoc;
1656 
1657  TRACE("(%s %u %x %p)\n",
1658  lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : strlenW(lpszUrl)) : "(null)",
1659  dwUrlLength, dwFlags, lpUC);
1660 
1661  if (!lpszUrl || !*lpszUrl || !lpUC)
1662  {
1664  return FALSE;
1665  }
1666  if (!dwUrlLength) dwUrlLength = strlenW(lpszUrl);
1667 
1668  if (dwFlags & ICU_DECODE)
1669  {
1670  WCHAR *url_tmp, *buffer;
1671  DWORD len = dwUrlLength + 1;
1672  BOOL ret;
1673 
1674  if (!(url_tmp = heap_strndupW(lpszUrl, dwUrlLength)))
1675  {
1677  return FALSE;
1678  }
1679 
1680  buffer = url_tmp;
1683  {
1684  buffer = heap_alloc(len * sizeof(WCHAR));
1685  if (!buffer)
1686  {
1688  heap_free(url_tmp);
1689  return FALSE;
1690  }
1692  }
1693  if (ret)
1695 
1696  if (buffer != url_tmp) heap_free(buffer);
1697  heap_free(url_tmp);
1698  return ret;
1699  }
1700  lpszap = lpszUrl;
1701 
1702  /* Determine if the URI is absolute. */
1703  while (lpszap - lpszUrl < dwUrlLength)
1704  {
1705  if (isalnumW(*lpszap) || *lpszap == '+' || *lpszap == '.' || *lpszap == '-')
1706  {
1707  lpszap++;
1708  continue;
1709  }
1710  if (*lpszap == ':')
1711  {
1712  found_colon = TRUE;
1713  lpszcp = lpszap;
1714  }
1715  else
1716  {
1717  lpszcp = lpszUrl; /* Relative url */
1718  }
1719 
1720  break;
1721  }
1722 
1723  if(!found_colon){
1725  return FALSE;
1726  }
1727 
1730 
1731  /* Parse <params> */
1732  lpszParam = memchrW(lpszap, '?', dwUrlLength - (lpszap - lpszUrl));
1733  if(!lpszParam)
1734  lpszParam = memchrW(lpszap, '#', dwUrlLength - (lpszap - lpszUrl));
1735 
1737  lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0))
1738  return FALSE;
1739 
1740 
1741  /* Get scheme first. */
1742  lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
1743  if(!set_url_component(&lpUC->lpszScheme, &lpUC->dwSchemeLength, lpszUrl, lpszcp - lpszUrl))
1744  return FALSE;
1745 
1746  /* Eat ':' in protocol. */
1747  lpszcp++;
1748 
1749  /* double slash indicates the net_loc portion is present */
1750  if ((lpszcp[0] == '/') && (lpszcp[1] == '/'))
1751  {
1752  lpszcp += 2;
1753 
1754  lpszNetLoc = memchrW(lpszcp, '/', dwUrlLength - (lpszcp - lpszUrl));
1755  if (lpszParam)
1756  {
1757  if (lpszNetLoc)
1758  lpszNetLoc = min(lpszNetLoc, lpszParam);
1759  else
1760  lpszNetLoc = lpszParam;
1761  }
1762  else if (!lpszNetLoc)
1763  lpszNetLoc = lpszcp + dwUrlLength-(lpszcp-lpszUrl);
1764 
1765  /* Parse net-loc */
1766  if (lpszNetLoc)
1767  {
1768  LPCWSTR lpszHost;
1769  LPCWSTR lpszPort;
1770 
1771  /* [<user>[<:password>]@]<host>[:<port>] */
1772  /* First find the user and password if they exist */
1773 
1774  lpszHost = memchrW(lpszcp, '@', dwUrlLength - (lpszcp - lpszUrl));
1775  if (lpszHost == NULL || lpszHost > lpszNetLoc)
1776  {
1777  /* username and password not specified. */
1780  }
1781  else /* Parse out username and password */
1782  {
1783  LPCWSTR lpszUser = lpszcp;
1784  LPCWSTR lpszPasswd = lpszHost;
1785 
1786  while (lpszcp < lpszHost)
1787  {
1788  if (*lpszcp == ':')
1789  lpszPasswd = lpszcp;
1790 
1791  lpszcp++;
1792  }
1793 
1794  if(!set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, lpszUser, lpszPasswd - lpszUser))
1795  return FALSE;
1796 
1797  if (lpszPasswd != lpszHost)
1798  lpszPasswd++;
1799  if(!set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength,
1800  lpszPasswd == lpszHost ? NULL : lpszPasswd, lpszHost - lpszPasswd))
1801  return FALSE;
1802 
1803  lpszcp++; /* Advance to beginning of host */
1804  }
1805 
1806  /* Parse <host><:port> */
1807 
1808  lpszHost = lpszcp;
1809  lpszPort = lpszNetLoc;
1810 
1811  /* special case for res:// URLs: there is no port here, so the host is the
1812  entire string up to the first '/' */
1813  if(lpUC->nScheme==INTERNET_SCHEME_RES)
1814  {
1815  if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
1816  return FALSE;
1817  lpszcp=lpszNetLoc;
1818  }
1819  else
1820  {
1821  while (lpszcp < lpszNetLoc)
1822  {
1823  if (*lpszcp == ':')
1824  lpszPort = lpszcp;
1825 
1826  lpszcp++;
1827  }
1828 
1829  /* If the scheme is "file" and the host is just one letter, it's not a host */
1830  if(lpUC->nScheme==INTERNET_SCHEME_FILE && lpszPort <= lpszHost+1)
1831  {
1832  lpszcp=lpszHost;
1834  }
1835  else
1836  {
1837  if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
1838  return FALSE;
1839  if (lpszPort != lpszNetLoc)
1840  lpUC->nPort = atoiW(++lpszPort);
1841  else switch (lpUC->nScheme)
1842  {
1843  case INTERNET_SCHEME_HTTP:
1845  break;
1846  case INTERNET_SCHEME_HTTPS:
1848  break;
1849  case INTERNET_SCHEME_FTP:
1851  break;
1854  break;
1855  default:
1856  break;
1857  }
1858  }
1859  }
1860  }
1861  }
1862  else
1863  {
1867  }
1868 
1869  /* Here lpszcp points to:
1870  *
1871  * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
1872  * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1873  */
1874  if (lpszcp != 0 && lpszcp - lpszUrl < dwUrlLength && (!lpszParam || lpszcp <= lpszParam))
1875  {
1876  DWORD len;
1877 
1878  /* Only truncate the parameter list if it's already been saved
1879  * in lpUC->lpszExtraInfo.
1880  */
1881  if (lpszParam && lpUC->dwExtraInfoLength && lpUC->lpszExtraInfo)
1882  len = lpszParam - lpszcp;
1883  else
1884  {
1885  /* Leave the parameter list in lpszUrlPath. Strip off any trailing
1886  * newlines if necessary.
1887  */
1888  LPWSTR lpsznewline = memchrW(lpszcp, '\n', dwUrlLength - (lpszcp - lpszUrl));
1889  if (lpsznewline != NULL)
1890  len = lpsznewline - lpszcp;
1891  else
1892  len = dwUrlLength-(lpszcp-lpszUrl);
1893  }
1894  if (lpUC->dwUrlPathLength && lpUC->lpszUrlPath &&
1895  lpUC->nScheme == INTERNET_SCHEME_FILE)
1896  {
1897  WCHAR tmppath[MAX_PATH];
1898  if (*lpszcp == '/')
1899  {
1900  len = MAX_PATH;
1901  PathCreateFromUrlW(lpszUrl, tmppath, &len, 0);
1902  }
1903  else
1904  {
1905  WCHAR *iter;
1906  memcpy(tmppath, lpszcp, len * sizeof(WCHAR));
1907  tmppath[len] = '\0';
1908 
1909  iter = tmppath;
1910  while (*iter) {
1911  if (*iter == '/')
1912  *iter = '\\';
1913  ++iter;
1914  }
1915  }
1916  /* if ends in \. or \.. append a backslash */
1917  if (tmppath[len - 1] == '.' &&
1918  (tmppath[len - 2] == '\\' ||
1919  (tmppath[len - 2] == '.' && tmppath[len - 3] == '\\')))
1920  {
1921  if (len < MAX_PATH - 1)
1922  {
1923  tmppath[len] = '\\';
1924  tmppath[len+1] = '\0';
1925  ++len;
1926  }
1927  }
1928  if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, tmppath, len))
1929  return FALSE;
1930  }
1931  else if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, len))
1932  return FALSE;
1933  }
1934  else
1935  {
1936  set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, 0);
1937  }
1938 
1939  TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_wn(lpszUrl,dwUrlLength),
1940  debugstr_wn(lpUC->lpszScheme,lpUC->dwSchemeLength),
1944 
1945  return TRUE;
1946 }
#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:2027
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:1620
#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:409
#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:1455
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1645
#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 4246 of file internet.c.

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