mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 09:23:38 +00:00
Convert the wininet HTTP functions to Unicode.
This commit is contained in:
parent
bcaac8e158
commit
a4e902cbe1
|
@ -404,11 +404,11 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
|||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI InternetGetCookieW(LPCSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||
BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||
LPWSTR lpCookieData, LPDWORD lpdwSize)
|
||||
{
|
||||
FIXME("STUB\n");
|
||||
TRACE("(%s,%s,%p)\n", debugstr_a(lpszUrl), debugstr_w(lpszCookieName),
|
||||
TRACE("(%s,%s,%p)\n", debugstr_w(lpszUrl), debugstr_w(lpszCookieName),
|
||||
lpCookieData);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -483,11 +483,11 @@ BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
|||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI InternetSetCookieW(LPCSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||
BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||
LPCWSTR lpCookieData)
|
||||
{
|
||||
FIXME("STUB\n");
|
||||
TRACE("(%s,%s,%s)\n", debugstr_a(lpszUrl),
|
||||
TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl),
|
||||
debugstr_w(lpszCookieName), debugstr_w(lpCookieData));
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -58,15 +58,15 @@ struct WININET_ErrorDlgParams
|
|||
*/
|
||||
static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
|
||||
{
|
||||
LPWININETHTTPREQA lpwhr = (LPWININETHTTPREQA) hRequest;
|
||||
LPWININETHTTPSESSIONA lpwhs = NULL;
|
||||
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hRequest;
|
||||
LPWININETHTTPSESSIONW lpwhs = NULL;
|
||||
LPWININETAPPINFOW hIC = NULL;
|
||||
LPWSTR p;
|
||||
|
||||
if (NULL == lpwhr)
|
||||
return FALSE;
|
||||
|
||||
lpwhs = (LPWININETHTTPSESSIONA) lpwhr->hdr.lpwhparent;
|
||||
lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
|
||||
if (NULL == lpwhs)
|
||||
return FALSE;
|
||||
|
||||
|
@ -194,12 +194,12 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer,
|
|||
static BOOL WININET_SetProxyAuthorization( HINTERNET hRequest,
|
||||
LPWSTR username, LPWSTR password )
|
||||
{
|
||||
LPWININETHTTPREQA lpwhr = (LPWININETHTTPREQA) hRequest;
|
||||
LPWININETHTTPSESSIONA lpwhs;
|
||||
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hRequest;
|
||||
LPWININETHTTPSESSIONW lpwhs;
|
||||
LPWININETAPPINFOW hIC;
|
||||
LPWSTR p;
|
||||
|
||||
lpwhs = (LPWININETHTTPSESSIONA) lpwhr->hdr.lpwhparent;
|
||||
lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
|
||||
if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION)
|
||||
{
|
||||
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
||||
|
@ -272,7 +272,7 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
|
|||
case WM_COMMAND:
|
||||
if( wParam == IDOK )
|
||||
{
|
||||
LPWININETHTTPREQA lpwhr = (LPWININETHTTPREQA) params->hRequest;
|
||||
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) params->hRequest;
|
||||
WCHAR username[0x20], password[0x20];
|
||||
|
||||
username[0] = 0;
|
||||
|
@ -320,7 +320,7 @@ static INT WININET_GetConnectionStatus( HINTERNET hRequest )
|
|||
|
||||
TRACE("%p\n", hRequest );
|
||||
|
||||
sz = sizeof(szStatus) / sizeof(WCHAR);
|
||||
sz = sizeof szStatus;
|
||||
index = 0;
|
||||
if( !HttpQueryInfoW( hRequest, HTTP_QUERY_STATUS_CODE,
|
||||
szStatus, &sz, &index))
|
||||
|
|
|
@ -144,6 +144,15 @@ inline static LPSTR FTP_strdup( LPCSTR str )
|
|||
return ret;
|
||||
}
|
||||
|
||||
inline static LPSTR FTP_strdup_WtoA( LPCWSTR str )
|
||||
{
|
||||
int len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
|
||||
LPSTR ret = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
if (ret)
|
||||
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* FtpPutFileA (WININET.@)
|
||||
*
|
||||
|
@ -1475,9 +1484,9 @@ lend:
|
|||
*
|
||||
*/
|
||||
|
||||
HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
||||
INTERNET_PORT nServerPort, LPCSTR lpszUserName,
|
||||
LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext)
|
||||
HINTERNET FTP_Connect(HINTERNET hInternet, LPCWSTR lpszServerName,
|
||||
INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
|
||||
LPCWSTR lpszPassword, DWORD dwFlags, DWORD dwContext)
|
||||
{
|
||||
struct sockaddr_in socketAddr;
|
||||
struct hostent *phe = NULL;
|
||||
|
@ -1488,8 +1497,8 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||
HINTERNET handle = NULL;
|
||||
|
||||
TRACE("0x%08lx Server(%s) Port(%d) User(%s) Paswd(%s)\n",
|
||||
(ULONG) hInternet, lpszServerName,
|
||||
nServerPort, lpszUserName, lpszPassword);
|
||||
(ULONG) hInternet, debugstr_w(lpszServerName),
|
||||
nServerPort, debugstr_w(lpszUserName), debugstr_w(lpszPassword));
|
||||
|
||||
hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet );
|
||||
if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
|
||||
|
@ -1506,7 +1515,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||
|
||||
if (hIC->lpfnStatusCB)
|
||||
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_RESOLVING_NAME,
|
||||
(LPSTR) lpszServerName, strlen(lpszServerName));
|
||||
(LPWSTR) lpszServerName, strlenW(lpszServerName));
|
||||
|
||||
if (!GetAddress(lpszServerName, nServerPort, &phe, &socketAddr))
|
||||
{
|
||||
|
@ -1516,7 +1525,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||
|
||||
if (hIC->lpfnStatusCB)
|
||||
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_NAME_RESOLVED,
|
||||
(LPSTR) lpszServerName, strlen(lpszServerName));
|
||||
(LPWSTR) lpszServerName, strlenW(lpszServerName));
|
||||
|
||||
nsocket = socket(AF_INET,SOCK_STREAM,0);
|
||||
if (nsocket == -1)
|
||||
|
@ -1558,7 +1567,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||
lpwfs->hdr.htype = WH_HFTPSESSION;
|
||||
lpwfs->hdr.dwFlags = dwFlags;
|
||||
lpwfs->hdr.dwContext = dwContext;
|
||||
lpwfs->hdr.lpwhparent = &hIC->hdr;
|
||||
lpwfs->hdr.lpwhparent = (LPWININETHANDLEHEADER)hInternet;
|
||||
lpwfs->sndSocket = nsocket;
|
||||
lpwfs->download_in_progress = NULL;
|
||||
sock_namelen = sizeof(lpwfs->socketAddress);
|
||||
|
@ -1572,8 +1581,8 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||
}
|
||||
else
|
||||
{
|
||||
lpwfs->lpszUserName = FTP_strdup(lpszUserName);
|
||||
lpwfs->lpszPassword = FTP_strdup(lpszPassword);
|
||||
lpwfs->lpszUserName = FTP_strdup_WtoA(lpszUserName);
|
||||
lpwfs->lpszPassword = FTP_strdup_WtoA(lpszPassword);
|
||||
}
|
||||
|
||||
if (FTP_ConnectToHost(lpwfs))
|
||||
|
@ -2543,7 +2552,7 @@ HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONA lpwfs, INT nSocket,
|
|||
if( handle )
|
||||
{
|
||||
lpwfn->hdr.htype = WH_HFINDNEXT;
|
||||
lpwfn->hdr.lpwhparent = &lpwfs->hdr;
|
||||
lpwfn->hdr.lpwhparent = (LPWININETHANDLEHEADER)lpwfs;
|
||||
lpwfn->hdr.dwContext = dwContext;
|
||||
lpwfn->index = 1; /* Next index is 1 since we return index 0 */
|
||||
lpwfn->size = dwSize;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -82,8 +82,8 @@ typedef struct
|
|||
} WITHREADERROR, *LPWITHREADERROR;
|
||||
|
||||
BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData);
|
||||
HINTERNET WINAPI INTERNET_InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
||||
LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext);
|
||||
HINTERNET WINAPI INTERNET_InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext);
|
||||
VOID INTERNET_ExecuteWork();
|
||||
|
||||
DWORD g_dwTlsErrIndex = TLS_OUT_OF_INDEXES;
|
||||
|
@ -647,15 +647,15 @@ BOOL WINAPI InternetGetConnectedStateExW(LPDWORD lpdwStatus, LPWSTR lpszConnecti
|
|||
* NULL on failure
|
||||
*
|
||||
*/
|
||||
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
|
||||
LPCSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
LPCSTR lpszUserName, LPCSTR lpszPassword,
|
||||
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet,
|
||||
LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
LPCWSTR lpszUserName, LPCWSTR lpszPassword,
|
||||
DWORD dwService, DWORD dwFlags, DWORD dwContext)
|
||||
{
|
||||
HINTERNET rc = (HINTERNET) NULL;
|
||||
|
||||
TRACE("(%p, %s, %i, %s, %s, %li, %li, %li)\n", hInternet, debugstr_a(lpszServerName),
|
||||
nServerPort, debugstr_a(lpszUserName), debugstr_a(lpszPassword),
|
||||
TRACE("(%p, %s, %i, %s, %s, %li, %li, %li)\n", hInternet, debugstr_w(lpszServerName),
|
||||
nServerPort, debugstr_w(lpszUserName), debugstr_w(lpszPassword),
|
||||
dwService, dwFlags, dwContext);
|
||||
|
||||
/* Clear any error information */
|
||||
|
@ -684,7 +684,7 @@ HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* InternetConnectW (WININET.@)
|
||||
* InternetConnectA (WININET.@)
|
||||
*
|
||||
* Open a ftp, gopher or http session
|
||||
*
|
||||
|
@ -693,46 +693,38 @@ HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
|
|||
* NULL on failure
|
||||
*
|
||||
*/
|
||||
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet,
|
||||
LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
LPCWSTR lpszUserName, LPCWSTR lpszPassword,
|
||||
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
|
||||
LPCSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
LPCSTR lpszUserName, LPCSTR lpszPassword,
|
||||
DWORD dwService, DWORD dwFlags, DWORD dwContext)
|
||||
{
|
||||
HINTERNET rc = (HINTERNET)NULL;
|
||||
INT lenServer = 0;
|
||||
INT lenUser = 0;
|
||||
INT lenPass = 0;
|
||||
CHAR *szServerName = NULL;
|
||||
CHAR *szUserName = NULL;
|
||||
CHAR *szPassword = NULL;
|
||||
INT len = 0;
|
||||
LPWSTR szServerName = NULL;
|
||||
LPWSTR szUserName = NULL;
|
||||
LPWSTR szPassword = NULL;
|
||||
|
||||
if (lpszServerName)
|
||||
{
|
||||
lenServer = WideCharToMultiByte(CP_ACP, 0, lpszServerName, -1, NULL, 0,
|
||||
NULL, NULL);
|
||||
szServerName = (CHAR *)HeapAlloc(GetProcessHeap(), 0, lenServer*sizeof(CHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, lpszServerName, -1, szServerName, lenServer,
|
||||
NULL, NULL);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, lpszServerName, -1, NULL, 0);
|
||||
szServerName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszServerName, -1, szServerName, len);
|
||||
}
|
||||
if (lpszUserName)
|
||||
{
|
||||
lenUser = WideCharToMultiByte(CP_ACP, 0, lpszUserName, -1, NULL, 0,
|
||||
NULL, NULL);
|
||||
szUserName = (CHAR *)HeapAlloc(GetProcessHeap(), 0, lenUser*sizeof(CHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, lpszUserName, -1, szUserName, lenUser,
|
||||
NULL, NULL);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
||||
szUserName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, szUserName, len);
|
||||
}
|
||||
if (lpszPassword)
|
||||
{
|
||||
lenPass = WideCharToMultiByte(CP_ACP, 0, lpszPassword, -1, NULL, 0,
|
||||
NULL, NULL);
|
||||
szPassword = (CHAR *)HeapAlloc(GetProcessHeap(), 0, lenPass*sizeof(CHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, lpszPassword, -1, szPassword, lenPass,
|
||||
NULL, NULL);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, lpszPassword, -1, NULL, 0);
|
||||
szPassword = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszPassword, -1, szPassword, len);
|
||||
}
|
||||
|
||||
|
||||
rc = InternetConnectA(hInternet, szServerName, nServerPort,
|
||||
rc = InternetConnectW(hInternet, szServerName, nServerPort,
|
||||
szUserName, szPassword, dwService, dwFlags, dwContext);
|
||||
|
||||
if (szServerName) HeapFree(GetProcessHeap(), 0, szServerName);
|
||||
|
@ -931,12 +923,12 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
|
|||
break;
|
||||
|
||||
case WH_HHTTPSESSION:
|
||||
HTTP_CloseHTTPSessionHandle((LPWININETHTTPSESSIONA) lpwh);
|
||||
HTTP_CloseHTTPSessionHandle((LPWININETHTTPSESSIONW) lpwh);
|
||||
retval = TRUE;
|
||||
break;
|
||||
|
||||
case WH_HHTTPREQ:
|
||||
HTTP_CloseHTTPRequestHandle((LPWININETHTTPREQA) lpwh);
|
||||
HTTP_CloseHTTPRequestHandle((LPWININETHTTPREQW) lpwh);
|
||||
retval = TRUE;
|
||||
break;
|
||||
|
||||
|
@ -1519,7 +1511,7 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
|
|||
FIXME("This shouldn't be here! We don't support this kind"
|
||||
" of connection anymore. Must use NETCON functions,"
|
||||
" especially if using SSL\n");
|
||||
nSocket = ((LPWININETHTTPREQA)lpwh)->netConnection.socketFD;
|
||||
nSocket = ((LPWININETHTTPREQW)lpwh)->netConnection.socketFD;
|
||||
break;
|
||||
|
||||
case WH_HFILE:
|
||||
|
@ -1568,7 +1560,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
|
|||
switch (lpwh->htype)
|
||||
{
|
||||
case WH_HHTTPREQ:
|
||||
if (!NETCON_recv(&((LPWININETHTTPREQA)lpwh)->netConnection, lpBuffer,
|
||||
if (!NETCON_recv(&((LPWININETHTTPREQW)lpwh)->netConnection, lpBuffer,
|
||||
dwNumOfBytesToRead, 0, (int *)dwNumOfBytesRead))
|
||||
{
|
||||
*dwNumOfBytesRead = 0;
|
||||
|
@ -1686,23 +1678,24 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
|
|||
ULONG type = lpwhh->htype;
|
||||
if (type == WH_HHTTPREQ)
|
||||
{
|
||||
LPWININETHTTPREQA lpreq = (LPWININETHTTPREQA) lpwhh;
|
||||
char url[1023];
|
||||
LPWININETHTTPREQW lpreq = (LPWININETHTTPREQW) lpwhh;
|
||||
WCHAR url[1023];
|
||||
WCHAR szFmt[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
|
||||
|
||||
sprintf(url,"http://%s%s",lpreq->lpszHostName,lpreq->lpszPath);
|
||||
TRACE("INTERNET_OPTION_URL: %s\n",url);
|
||||
if (*lpdwBufferLength < strlen(url)+1)
|
||||
sprintfW(url,szFmt,lpreq->lpszHostName,lpreq->lpszPath);
|
||||
TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
|
||||
if (*lpdwBufferLength < strlenW(url)+1)
|
||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
else
|
||||
{
|
||||
if(bIsUnicode)
|
||||
if(!bIsUnicode)
|
||||
{
|
||||
*lpdwBufferLength=MultiByteToWideChar(CP_ACP,0,url,-1,lpBuffer,*lpdwBufferLength);
|
||||
*lpdwBufferLength=WideCharToMultiByte(CP_ACP,0,url,-1,lpBuffer,*lpdwBufferLength,NULL,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(lpBuffer, url, strlen(url)+1);
|
||||
*lpdwBufferLength = strlen(url)+1;
|
||||
strcpyW(lpBuffer, url);
|
||||
*lpdwBufferLength = strlenW(url)+1;
|
||||
}
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
|
@ -2046,18 +2039,18 @@ BOOL WINAPI InternetCheckConnectionW(LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRes
|
|||
* RETURNS
|
||||
* handle of connection or NULL on failure
|
||||
*/
|
||||
HINTERNET WINAPI INTERNET_InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
||||
LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
||||
HINTERNET WINAPI INTERNET_InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
||||
{
|
||||
URL_COMPONENTSA urlComponents;
|
||||
char protocol[32], hostName[MAXHOSTNAME], userName[1024];
|
||||
char password[1024], path[2048], extra[1024];
|
||||
URL_COMPONENTSW urlComponents;
|
||||
WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024];
|
||||
WCHAR password[1024], path[2048], extra[1024];
|
||||
HINTERNET client = NULL, client1 = NULL;
|
||||
|
||||
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx\n", hInternet, debugstr_a(lpszUrl), debugstr_a(lpszHeaders),
|
||||
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx\n", hInternet, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
|
||||
dwHeadersLength, dwFlags, dwContext);
|
||||
|
||||
urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
|
||||
urlComponents.dwStructSize = sizeof(URL_COMPONENTSW);
|
||||
urlComponents.lpszScheme = protocol;
|
||||
urlComponents.dwSchemeLength = 32;
|
||||
urlComponents.lpszHostName = hostName;
|
||||
|
@ -2070,37 +2063,38 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
|||
urlComponents.dwUrlPathLength = 2048;
|
||||
urlComponents.lpszExtraInfo = extra;
|
||||
urlComponents.dwExtraInfoLength = 1024;
|
||||
if(!InternetCrackUrlA(lpszUrl, strlen(lpszUrl), 0, &urlComponents))
|
||||
if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents))
|
||||
return NULL;
|
||||
switch(urlComponents.nScheme) {
|
||||
case INTERNET_SCHEME_FTP:
|
||||
if(urlComponents.nPort == 0)
|
||||
urlComponents.nPort = INTERNET_DEFAULT_FTP_PORT;
|
||||
client = InternetConnectA(hInternet, hostName, urlComponents.nPort,
|
||||
client = InternetConnectW(hInternet, hostName, urlComponents.nPort,
|
||||
userName, password, INTERNET_SERVICE_FTP, dwFlags, dwContext);
|
||||
client1 = FtpOpenFileA(client, path, GENERIC_READ, dwFlags, dwContext);
|
||||
client1 = FtpOpenFileW(client, path, GENERIC_READ, dwFlags, dwContext);
|
||||
break;
|
||||
|
||||
case INTERNET_SCHEME_HTTP:
|
||||
case INTERNET_SCHEME_HTTPS: {
|
||||
LPCSTR accept[2] = { "*/*", NULL };
|
||||
WCHAR szStars[] = { '*','/','*', 0 };
|
||||
LPCWSTR accept[2] = { szStars, NULL };
|
||||
if(urlComponents.nPort == 0) {
|
||||
if(urlComponents.nScheme == INTERNET_SCHEME_HTTP)
|
||||
urlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||
else
|
||||
urlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||
}
|
||||
client = InternetConnectA(hInternet, hostName, urlComponents.nPort, userName,
|
||||
client = InternetConnectW(hInternet, hostName, urlComponents.nPort, userName,
|
||||
password, INTERNET_SERVICE_HTTP, dwFlags, dwContext);
|
||||
if(client == NULL)
|
||||
break;
|
||||
client1 = HttpOpenRequestA(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
|
||||
client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
|
||||
if(client1 == NULL) {
|
||||
InternetCloseHandle(client);
|
||||
break;
|
||||
}
|
||||
HttpAddRequestHeadersA(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
|
||||
if (!HTTP_HttpSendRequestA(client1, NULL, 0, NULL, 0)) {
|
||||
HttpAddRequestHeadersW(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
|
||||
if (!HTTP_HttpSendRequestW(client1, NULL, 0, NULL, 0)) {
|
||||
InternetCloseHandle(client1);
|
||||
InternetCloseHandle(client);
|
||||
client1 = NULL;
|
||||
|
@ -2127,13 +2121,13 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
|||
* RETURNS
|
||||
* handle of connection or NULL on failure
|
||||
*/
|
||||
HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
||||
LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
||||
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
||||
{
|
||||
HINTERNET ret = NULL;
|
||||
LPWININETAPPINFOW hIC = NULL;
|
||||
|
||||
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx\n", hInternet, debugstr_a(lpszUrl), debugstr_a(lpszHeaders),
|
||||
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx\n", hInternet, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
|
||||
dwHeadersLength, dwFlags, dwContext);
|
||||
|
||||
hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet );
|
||||
|
@ -2144,17 +2138,17 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
|||
|
||||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) {
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_INTERNETOPENURLA *req;
|
||||
struct WORKREQ_INTERNETOPENURLW *req;
|
||||
|
||||
workRequest.asyncall = INTERNETOPENURLA;
|
||||
workRequest.asyncall = INTERNETOPENURLW;
|
||||
workRequest.handle = hInternet;
|
||||
req = &workRequest.u.InternetOpenUrlA;
|
||||
req = &workRequest.u.InternetOpenUrlW;
|
||||
if (lpszUrl)
|
||||
req->lpszUrl = WININET_strdup(lpszUrl);
|
||||
req->lpszUrl = WININET_strdupW(lpszUrl);
|
||||
else
|
||||
req->lpszUrl = 0;
|
||||
if (lpszHeaders)
|
||||
req->lpszHeaders = WININET_strdup(lpszHeaders);
|
||||
req->lpszHeaders = WININET_strdupW(lpszHeaders);
|
||||
else
|
||||
req->lpszHeaders = 0;
|
||||
req->dwHeadersLength = dwHeadersLength;
|
||||
|
@ -2167,7 +2161,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
|||
*/
|
||||
SetLastError(ERROR_IO_PENDING);
|
||||
} else {
|
||||
ret = INTERNET_InternetOpenUrlA(hInternet, lpszUrl, lpszHeaders, dwHeadersLength, dwFlags, dwContext);
|
||||
ret = INTERNET_InternetOpenUrlW(hInternet, lpszUrl, lpszHeaders, dwHeadersLength, dwFlags, dwContext);
|
||||
}
|
||||
|
||||
lend:
|
||||
|
@ -2184,15 +2178,15 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
|||
* RETURNS
|
||||
* handle of connection or NULL on failure
|
||||
*/
|
||||
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
||||
HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
||||
LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
||||
{
|
||||
HINTERNET rc = (HINTERNET)NULL;
|
||||
|
||||
INT lenUrl = WideCharToMultiByte(CP_ACP, 0, lpszUrl, -1, NULL, 0, NULL, NULL);
|
||||
INT lenHeaders = WideCharToMultiByte(CP_ACP, 0, lpszHeaders, -1, NULL, 0, NULL, NULL);
|
||||
CHAR *szUrl = (CHAR *)HeapAlloc(GetProcessHeap(), 0, lenUrl*sizeof(CHAR));
|
||||
CHAR *szHeaders = (CHAR *)HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(CHAR));
|
||||
INT lenUrl = MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, NULL, 0 );
|
||||
INT lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, -1, NULL, 0 );
|
||||
LPWSTR szUrl = HeapAlloc(GetProcessHeap(), 0, lenUrl*sizeof(WCHAR));
|
||||
LPWSTR szHeaders = HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(WCHAR));
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
|
@ -2205,12 +2199,10 @@ HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
|||
return (HINTERNET)NULL;
|
||||
}
|
||||
|
||||
WideCharToMultiByte(CP_ACP, 0, lpszUrl, -1, szUrl, lenUrl,
|
||||
NULL, NULL);
|
||||
WideCharToMultiByte(CP_ACP, 0, lpszHeaders, -1, szHeaders, lenHeaders,
|
||||
NULL, NULL);
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, szUrl, lenUrl);
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, -1, szHeaders, lenHeaders);
|
||||
|
||||
rc = InternetOpenUrlA(hInternet, szUrl, szHeaders,
|
||||
rc = InternetOpenUrlW(hInternet, szUrl, szHeaders,
|
||||
dwHeadersLength, dwFlags, dwContext);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, szUrl);
|
||||
|
@ -2438,10 +2430,10 @@ VOID INTERNET_ExecuteWork()
|
|||
FE(FTPREMOVEDIRECTORYA),
|
||||
FE(FTPRENAMEFILEA),
|
||||
FE(INTERNETFINDNEXTA),
|
||||
FE(HTTPSENDREQUESTA),
|
||||
FE(HTTPOPENREQUESTA),
|
||||
FE(HTTPSENDREQUESTW),
|
||||
FE(HTTPOPENREQUESTW),
|
||||
FE(SENDCALLBACK),
|
||||
FE(INTERNETOPENURLA)
|
||||
FE(INTERNETOPENURLW)
|
||||
#undef FE
|
||||
};
|
||||
int i;
|
||||
|
@ -2571,22 +2563,22 @@ VOID INTERNET_ExecuteWork()
|
|||
}
|
||||
break;
|
||||
|
||||
case HTTPSENDREQUESTA:
|
||||
case HTTPSENDREQUESTW:
|
||||
{
|
||||
struct WORKREQ_HTTPSENDREQUESTA *req = &workRequest.u.HttpSendRequestA;
|
||||
struct WORKREQ_HTTPSENDREQUESTW *req = &workRequest.u.HttpSendRequestW;
|
||||
|
||||
HTTP_HttpSendRequestA(workRequest.handle, req->lpszHeader,
|
||||
HTTP_HttpSendRequestW(workRequest.handle, req->lpszHeader,
|
||||
req->dwHeaderLength, req->lpOptional, req->dwOptionalLength);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszHeader);
|
||||
}
|
||||
break;
|
||||
|
||||
case HTTPOPENREQUESTA:
|
||||
case HTTPOPENREQUESTW:
|
||||
{
|
||||
struct WORKREQ_HTTPOPENREQUESTA *req = &workRequest.u.HttpOpenRequestA;
|
||||
struct WORKREQ_HTTPOPENREQUESTW *req = &workRequest.u.HttpOpenRequestW;
|
||||
|
||||
HTTP_HttpOpenRequestA(workRequest.handle, req->lpszVerb,
|
||||
HTTP_HttpOpenRequestW(workRequest.handle, req->lpszVerb,
|
||||
req->lpszObjectName, req->lpszVersion, req->lpszReferrer,
|
||||
req->lpszAcceptTypes, req->dwFlags, req->dwContext);
|
||||
|
||||
|
@ -2607,11 +2599,11 @@ VOID INTERNET_ExecuteWork()
|
|||
}
|
||||
break;
|
||||
|
||||
case INTERNETOPENURLA:
|
||||
case INTERNETOPENURLW:
|
||||
{
|
||||
struct WORKREQ_INTERNETOPENURLA *req = &workRequest.u.InternetOpenUrlA;
|
||||
struct WORKREQ_INTERNETOPENURLW *req = &workRequest.u.InternetOpenUrlW;
|
||||
|
||||
INTERNET_InternetOpenUrlA(workRequest.handle, req->lpszUrl,
|
||||
INTERNET_InternetOpenUrlW(workRequest.handle, req->lpszUrl,
|
||||
req->lpszHeaders, req->dwHeadersLength, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszUrl);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszHeaders);
|
||||
|
@ -2705,12 +2697,12 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
|
|||
LPDWORD lpdwNumberOfBytesAvailble,
|
||||
DWORD dwFlags, DWORD dwConext)
|
||||
{
|
||||
LPWININETHTTPREQA lpwhr;
|
||||
LPWININETHTTPREQW lpwhr;
|
||||
INT retval = -1;
|
||||
char buffer[4048];
|
||||
|
||||
|
||||
lpwhr = (LPWININETHTTPREQA) WININET_GetObject( hFile );
|
||||
lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hFile );
|
||||
if (NULL == lpwhr)
|
||||
{
|
||||
SetLastError(ERROR_NO_MORE_FILES);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#ifndef _WINE_INTERNET_H_
|
||||
#define _WINE_INTERNET_H_
|
||||
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
|
@ -61,6 +63,13 @@ inline static LPSTR WININET_strdup( LPCSTR str )
|
|||
return ret;
|
||||
}
|
||||
|
||||
inline static LPWSTR WININET_strdupW( LPCWSTR str )
|
||||
{
|
||||
LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1)*sizeof(WCHAR) );
|
||||
if (ret) strcpyW( ret, str );
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WH_HINIT = INTERNET_HANDLE_TYPE_INTERNET,
|
||||
|
@ -98,12 +107,12 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
WININETHANDLEHEADER hdr;
|
||||
LPSTR lpszServerName;
|
||||
LPSTR lpszUserName;
|
||||
LPWSTR lpszServerName;
|
||||
LPWSTR lpszUserName;
|
||||
INTERNET_PORT nServerPort;
|
||||
struct sockaddr_in socketAddress;
|
||||
struct hostent *phostent;
|
||||
} WININETHTTPSESSIONA, *LPWININETHTTPSESSIONA;
|
||||
} WININETHTTPSESSIONW, *LPWININETHTTPSESSIONW;
|
||||
|
||||
#define HDR_ISREQUEST 0x0001
|
||||
#define HDR_COMMADELIMITED 0x0002
|
||||
|
@ -111,24 +120,24 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
LPSTR lpszField;
|
||||
LPSTR lpszValue;
|
||||
LPWSTR lpszField;
|
||||
LPWSTR lpszValue;
|
||||
WORD wFlags;
|
||||
WORD wCount;
|
||||
} HTTPHEADERA, *LPHTTPHEADERA;
|
||||
} HTTPHEADERW, *LPHTTPHEADERW;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WININETHANDLEHEADER hdr;
|
||||
LPSTR lpszPath;
|
||||
LPSTR lpszVerb;
|
||||
LPSTR lpszHostName;
|
||||
LPWSTR lpszPath;
|
||||
LPWSTR lpszVerb;
|
||||
LPWSTR lpszHostName;
|
||||
WININET_NETCONNECTION netConnection;
|
||||
HTTPHEADERA StdHeaders[HTTP_QUERY_MAX+1];
|
||||
HTTPHEADERA *pCustHeaders;
|
||||
HTTPHEADERW StdHeaders[HTTP_QUERY_MAX+1];
|
||||
HTTPHEADERW *pCustHeaders;
|
||||
INT nCustHeaders;
|
||||
} WININETHTTPREQA, *LPWININETHTTPREQA;
|
||||
} WININETHTTPREQW, *LPWININETHTTPREQW;
|
||||
|
||||
|
||||
typedef struct
|
||||
|
@ -185,10 +194,10 @@ typedef enum
|
|||
FTPREMOVEDIRECTORYA,
|
||||
FTPRENAMEFILEA,
|
||||
INTERNETFINDNEXTA,
|
||||
HTTPSENDREQUESTA,
|
||||
HTTPOPENREQUESTA,
|
||||
HTTPSENDREQUESTW,
|
||||
HTTPOPENREQUESTW,
|
||||
SENDCALLBACK,
|
||||
INTERNETOPENURLA,
|
||||
INTERNETOPENURLW,
|
||||
} ASYNC_FUNC;
|
||||
|
||||
struct WORKREQ_FTPPUTFILEA
|
||||
|
@ -262,20 +271,20 @@ struct WORKREQ_INTERNETFINDNEXTA
|
|||
LPWIN32_FIND_DATAA lpFindFileData;
|
||||
};
|
||||
|
||||
struct WORKREQ_HTTPOPENREQUESTA
|
||||
struct WORKREQ_HTTPOPENREQUESTW
|
||||
{
|
||||
LPSTR lpszVerb;
|
||||
LPSTR lpszObjectName;
|
||||
LPSTR lpszVersion;
|
||||
LPSTR lpszReferrer;
|
||||
LPCSTR *lpszAcceptTypes;
|
||||
LPWSTR lpszVerb;
|
||||
LPWSTR lpszObjectName;
|
||||
LPWSTR lpszVersion;
|
||||
LPWSTR lpszReferrer;
|
||||
LPCWSTR *lpszAcceptTypes;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_HTTPSENDREQUESTA
|
||||
struct WORKREQ_HTTPSENDREQUESTW
|
||||
{
|
||||
LPSTR lpszHeader;
|
||||
LPWSTR lpszHeader;
|
||||
DWORD dwHeaderLength;
|
||||
LPVOID lpOptional;
|
||||
DWORD dwOptionalLength;
|
||||
|
@ -290,11 +299,11 @@ struct WORKREQ_SENDCALLBACK
|
|||
DWORD dwStatusInfoLength;
|
||||
};
|
||||
|
||||
struct WORKREQ_INTERNETOPENURLA
|
||||
struct WORKREQ_INTERNETOPENURLW
|
||||
{
|
||||
HINTERNET hInternet;
|
||||
LPSTR lpszUrl;
|
||||
LPSTR lpszHeaders;
|
||||
LPWSTR lpszUrl;
|
||||
LPWSTR lpszHeaders;
|
||||
DWORD dwHeadersLength;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
|
@ -317,10 +326,10 @@ typedef struct WORKREQ
|
|||
struct WORKREQ_FTPREMOVEDIRECTORYA FtpRemoveDirectoryA;
|
||||
struct WORKREQ_FTPRENAMEFILEA FtpRenameFileA;
|
||||
struct WORKREQ_INTERNETFINDNEXTA InternetFindNextA;
|
||||
struct WORKREQ_HTTPOPENREQUESTA HttpOpenRequestA;
|
||||
struct WORKREQ_HTTPSENDREQUESTA HttpSendRequestA;
|
||||
struct WORKREQ_HTTPOPENREQUESTW HttpOpenRequestW;
|
||||
struct WORKREQ_HTTPSENDREQUESTW HttpSendRequestW;
|
||||
struct WORKREQ_SENDCALLBACK SendCallback;
|
||||
struct WORKREQ_INTERNETOPENURLA InternetOpenUrlA;
|
||||
struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW;
|
||||
} u;
|
||||
|
||||
struct WORKREQ *next;
|
||||
|
@ -333,17 +342,17 @@ LPWININETHANDLEHEADER WININET_GetObject( HINTERNET hinternet );
|
|||
BOOL WININET_FreeHandle( HINTERNET hinternet );
|
||||
HINTERNET WININET_FindHandle( LPWININETHANDLEHEADER info );
|
||||
|
||||
time_t ConvertTimeString(LPCSTR asctime);
|
||||
time_t ConvertTimeString(LPCWSTR asctime);
|
||||
|
||||
HINTERNET FTP_Connect(HINTERNET hInterent, LPCSTR lpszServerName,
|
||||
INTERNET_PORT nServerPort, LPCSTR lpszUserName,
|
||||
LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
|
||||
HINTERNET FTP_Connect(HINTERNET hInterent, LPCWSTR lpszServerName,
|
||||
INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
|
||||
LPCWSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
|
||||
|
||||
HINTERNET HTTP_Connect(HINTERNET hInterent, LPCSTR lpszServerName,
|
||||
INTERNET_PORT nServerPort, LPCSTR lpszUserName,
|
||||
LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
|
||||
HINTERNET HTTP_Connect(HINTERNET hInterent, LPCWSTR lpszServerName,
|
||||
INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
|
||||
LPCWSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
|
||||
|
||||
BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
struct hostent **phe, struct sockaddr_in *psa);
|
||||
|
||||
void INTERNET_SetLastError(DWORD dwError);
|
||||
|
@ -373,14 +382,14 @@ BOOLAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
|
|||
BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
|
||||
DWORD dwContext);
|
||||
|
||||
BOOLAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
|
||||
BOOLAPI HTTP_HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
|
||||
DWORD dwHeaderLength, LPVOID lpOptional ,DWORD dwOptionalLength);
|
||||
INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
|
||||
LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion,
|
||||
LPCSTR lpszReferrer , LPCSTR *lpszAcceptTypes,
|
||||
INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestW(HINTERNET hHttpSession,
|
||||
LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion,
|
||||
LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes,
|
||||
DWORD dwFlags, DWORD dwContext);
|
||||
void HTTP_CloseHTTPSessionHandle(LPWININETHTTPSESSIONA lpwhs);
|
||||
void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr);
|
||||
void HTTP_CloseHTTPSessionHandle(LPWININETHTTPSESSIONW lpwhs);
|
||||
void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQW lpwhr);
|
||||
|
||||
VOID SendAsyncCallback(LPWININETAPPINFOW hIC, HINTERNET hHttpSession,
|
||||
DWORD dwContext, DWORD dwInternetStatus, LPVOID
|
||||
|
@ -390,7 +399,7 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, HINTERNET hHttpSession,
|
|||
DWORD dwContext, DWORD dwInternetStatus, LPVOID
|
||||
lpvStatusInfo , DWORD dwStatusInfoLength);
|
||||
|
||||
BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQA lpwhr,
|
||||
BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQW lpwhr,
|
||||
LPCWSTR username, LPCWSTR password );
|
||||
|
||||
BOOL NETCON_connected(WININET_NETCONNECTION *connection);
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
@ -446,8 +448,8 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD
|
|||
lend: /* FIXME: don't use labels */
|
||||
if (bSuccess)
|
||||
{
|
||||
lpszBuffer[nRecv] = '\0';
|
||||
*dwBuffer = nRecv - 1;
|
||||
lpszBuffer[nRecv++] = '\0';
|
||||
*dwBuffer = nRecv;
|
||||
TRACE(":%d %s\n", nRecv, lpszBuffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -487,8 +489,8 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD
|
|||
pSSL_CTX_set_timeout(ctx, prev_timeout);
|
||||
if (success)
|
||||
{
|
||||
lpszBuffer[nRecv] = '\0';
|
||||
*dwBuffer = nRecv - 1;
|
||||
lpszBuffer[nRecv++] = '\0';
|
||||
*dwBuffer = nRecv;
|
||||
TRACE("_SSL:%d %s\n", nRecv, lpszBuffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "winbase.h"
|
||||
#include "wininet.h"
|
||||
#include "winerror.h"
|
||||
#include "winnls.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "internet.h"
|
||||
|
@ -41,17 +42,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
|||
|
||||
#define TIME_STRING_LEN 30
|
||||
|
||||
time_t ConvertTimeString(LPCSTR asctime)
|
||||
time_t ConvertTimeString(LPCWSTR asctime)
|
||||
{
|
||||
char tmpChar[TIME_STRING_LEN];
|
||||
char *tmpChar2;
|
||||
WCHAR tmpChar[TIME_STRING_LEN];
|
||||
WCHAR *tmpChar2;
|
||||
struct tm t;
|
||||
int timelen = strlen(asctime);
|
||||
int timelen = strlenW(asctime);
|
||||
|
||||
if(!asctime || !timelen)
|
||||
return 0;
|
||||
|
||||
strncpy(tmpChar, asctime, TIME_STRING_LEN);
|
||||
strncpyW(tmpChar, asctime, TIME_STRING_LEN);
|
||||
|
||||
/* Assert that the string is the expected length */
|
||||
if (tmpChar[TIME_STRING_LEN] != '\0')
|
||||
|
@ -72,11 +73,11 @@ time_t ConvertTimeString(LPCSTR asctime)
|
|||
tmpChar[22]='\0';
|
||||
tmpChar[25]='\0';
|
||||
|
||||
t.tm_year = atoi(tmpChar+12) - 1900;
|
||||
t.tm_mday = atoi(tmpChar+5);
|
||||
t.tm_hour = atoi(tmpChar+17);
|
||||
t.tm_min = atoi(tmpChar+20);
|
||||
t.tm_sec = atoi(tmpChar+23);
|
||||
t.tm_year = atoiW(tmpChar+12) - 1900;
|
||||
t.tm_mday = atoiW(tmpChar+5);
|
||||
t.tm_hour = atoiW(tmpChar+17);
|
||||
t.tm_min = atoiW(tmpChar+20);
|
||||
t.tm_sec = atoiW(tmpChar+23);
|
||||
|
||||
/* and month */
|
||||
tmpChar2 = tmpChar + 8;
|
||||
|
@ -126,34 +127,36 @@ time_t ConvertTimeString(LPCSTR asctime)
|
|||
}
|
||||
|
||||
|
||||
BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
struct hostent **phe, struct sockaddr_in *psa)
|
||||
{
|
||||
char *found;
|
||||
WCHAR *found;
|
||||
char *name;
|
||||
int len, sz;
|
||||
|
||||
TRACE("%s\n", lpszServerName);
|
||||
TRACE("%s\n", debugstr_w(lpszServerName));
|
||||
|
||||
/* Validate server name first
|
||||
* Check if there is sth. like
|
||||
* pinger.macromedia.com:80
|
||||
* if yes, eliminate the :80....
|
||||
*/
|
||||
found = strchr(lpszServerName, ':');
|
||||
found = strchrW(lpszServerName, ':');
|
||||
if (found)
|
||||
{
|
||||
int len = found - lpszServerName;
|
||||
char *new = HeapAlloc(GetProcessHeap(), 0, len + 1);
|
||||
memcpy( new, lpszServerName, len );
|
||||
new[len] = '\0';
|
||||
TRACE("Found a ':' inside the server name, reparsed name: %s\n", new);
|
||||
*phe = gethostbyname(new);
|
||||
HeapFree( GetProcessHeap(), 0, new );
|
||||
}
|
||||
else *phe = gethostbyname(lpszServerName);
|
||||
len = found - lpszServerName;
|
||||
else
|
||||
len = strlenW(lpszServerName);
|
||||
|
||||
sz = WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, NULL, 0, NULL, NULL );
|
||||
name = HeapAlloc(GetProcessHeap(), 0, sz+1);
|
||||
WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, name, sz, NULL, NULL );
|
||||
name[sz] = 0;
|
||||
*phe = gethostbyname(name);
|
||||
HeapFree( GetProcessHeap(), 0, name );
|
||||
|
||||
if (NULL == *phe)
|
||||
{
|
||||
TRACE("Failed to get hostname: (%s)\n", lpszServerName);
|
||||
TRACE("Failed to get hostname: (%s)\n", debugstr_w(lpszServerName) );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
@ stdcall GopherOpenFileA(ptr str str long long)
|
||||
@ stdcall GopherOpenFileW(ptr wstr wstr long long)
|
||||
@ stdcall HttpAddRequestHeadersA(ptr str long long)
|
||||
@ stub HttpAddRequestHeadersW
|
||||
@ stdcall HttpAddRequestHeadersW(ptr wstr long long)
|
||||
@ stdcall HttpEndRequestA(ptr ptr long long)
|
||||
@ stdcall HttpEndRequestW(ptr ptr long long)
|
||||
@ stdcall HttpOpenRequestA(ptr str str str str ptr long long)
|
||||
|
|
|
@ -1142,11 +1142,11 @@ BOOLAPI HttpQueryInfoW(HINTERNET ,DWORD ,LPVOID lpBuffer ,LPDWORD ,LPDWORD lpdwI
|
|||
#define HttpQueryInfo WINELIB_NAME_AW(HttpQueryInfo)
|
||||
|
||||
BOOLAPI InternetSetCookieA(LPCSTR ,LPCSTR ,LPCSTR);
|
||||
BOOLAPI InternetSetCookieW(LPCSTR ,LPCWSTR ,LPCWSTR);
|
||||
BOOLAPI InternetSetCookieW(LPCWSTR ,LPCWSTR ,LPCWSTR);
|
||||
#define InternetSetCookie WINELIB_NAME_AW(InternetSetCookie)
|
||||
|
||||
BOOLAPI InternetGetCookieA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD);
|
||||
BOOLAPI InternetGetCookieW(LPCSTR ,LPCWSTR ,LPWSTR ,LPDWORD);
|
||||
BOOLAPI InternetGetCookieW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD);
|
||||
#define InternetGetCookie WINELIB_NAME_AW(InternetGetCookie)
|
||||
|
||||
INTERNETAPI DWORD WINAPI InternetAttemptConnect(DWORD);
|
||||
|
|
Loading…
Reference in a new issue