wininet: Use wrappers for HeapAlloc calls.

This commit is contained in:
Jacek Caban 2011-04-21 13:39:03 +02:00 committed by Alexandre Julliard
parent a08aa5391e
commit 354a74e004
8 changed files with 101 additions and 103 deletions

View File

@ -89,7 +89,7 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain);
/* adds a cookie to the domain */ /* adds a cookie to the domain */
static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR data, FILETIME expiry) static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR data, FILETIME expiry)
{ {
cookie *newCookie = HeapAlloc(GetProcessHeap(), 0, sizeof(cookie)); cookie *newCookie = heap_alloc(sizeof(cookie));
list_init(&newCookie->entry); list_init(&newCookie->entry);
newCookie->lpCookieName = NULL; newCookie->lpCookieName = NULL;
@ -145,7 +145,7 @@ static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
/* allocates a domain and adds it to the end */ /* allocates a domain and adds it to the end */
static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path) static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
{ {
cookie_domain *newDomain = HeapAlloc(GetProcessHeap(), 0, sizeof(cookie_domain)); cookie_domain *newDomain = heap_alloc(sizeof(cookie_domain));
list_init(&newDomain->entry); list_init(&newDomain->entry);
list_init(&newDomain->cookie_list); list_init(&newDomain->cookie_list);
@ -397,7 +397,7 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
r = InternetGetCookieW( url, name, NULL, &len ); r = InternetGetCookieW( url, name, NULL, &len );
if( r ) if( r )
{ {
szCookieData = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); szCookieData = heap_alloc(len * sizeof(WCHAR));
if( !szCookieData ) if( !szCookieData )
{ {
r = FALSE; r = FALSE;
@ -453,7 +453,7 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST
if (value != data) if (value != data)
HeapFree(GetProcessHeap(), 0, value); HeapFree(GetProcessHeap(), 0, value);
value = HeapAlloc(GetProcessHeap(), 0, (ptr - data) * sizeof(WCHAR)); value = heap_alloc((ptr - data) * sizeof(WCHAR));
if (value == NULL) if (value == NULL)
{ {
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);

View File

@ -916,7 +916,7 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
len = *lpdwCurrentDirectory; len = *lpdwCurrentDirectory;
if(lpszCurrentDirectory) if(lpszCurrentDirectory)
{ {
dir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); dir = heap_alloc(len * sizeof(WCHAR));
if (NULL == dir) if (NULL == dir)
{ {
INTERNET_SetLastError(ERROR_OUTOFMEMORY); INTERNET_SetLastError(ERROR_OUTOFMEMORY);
@ -1383,7 +1383,7 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs,
if (!InternetCreateUrlW(&uc, 0, NULL, &len) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) if (!InternetCreateUrlW(&uc, 0, NULL, &len) && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{ {
WCHAR *url = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); WCHAR *url = heap_alloc(len * sizeof(WCHAR));
if (url && InternetCreateUrlW(&uc, 0, url, &len) && CreateUrlCacheEntryW(url, 0, NULL, filename, 0)) if (url && InternetCreateUrlW(&uc, 0, url, &len) && CreateUrlCacheEntryW(url, 0, NULL, filename, 0))
{ {
@ -2290,7 +2290,7 @@ BOOL WINAPI FtpCommandW( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
} }
len = WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, NULL, 0, NULL, NULL) + strlen(szCRLF); len = WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, NULL, 0, NULL, NULL) + strlen(szCRLF);
if ((cmd = HeapAlloc(GetProcessHeap(), 0, len ))) if ((cmd = heap_alloc(len)))
WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, cmd, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, cmd, len, NULL, NULL);
else else
{ {
@ -2660,7 +2660,7 @@ static BOOL FTP_SendCommandA(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
dwParamLen = lpszParam?strlen(lpszParam)+1:0; dwParamLen = lpszParam?strlen(lpszParam)+1:0;
len = dwParamLen + strlen(szFtpCommands[ftpCmd]) + strlen(szCRLF); len = dwParamLen + strlen(szFtpCommands[ftpCmd]) + strlen(szCRLF);
if (NULL == (buf = HeapAlloc(GetProcessHeap(), 0, len+1))) if (NULL == (buf = heap_alloc(len+1)))
{ {
INTERNET_SetLastError(ERROR_OUTOFMEMORY); INTERNET_SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
@ -3227,7 +3227,7 @@ static BOOL FTP_SendData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE hFile)
CHAR *lpszBuffer; CHAR *lpszBuffer;
TRACE("\n"); TRACE("\n");
lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE); lpszBuffer = heap_alloc_zero(sizeof(CHAR)*DATA_PACKET_SIZE);
/* Get the size of the file. */ /* Get the size of the file. */
GetFileInformationByHandle(hFile, &fi); GetFileInformationByHandle(hFile, &fi);
@ -3349,7 +3349,7 @@ static BOOL FTP_RetrieveFileData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE h
TRACE("\n"); TRACE("\n");
lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE); lpszBuffer = heap_alloc_zero(sizeof(CHAR)*DATA_PACKET_SIZE);
if (NULL == lpszBuffer) if (NULL == lpszBuffer)
{ {
INTERNET_SetLastError(ERROR_OUTOFMEMORY); INTERNET_SetLastError(ERROR_OUTOFMEMORY);
@ -3752,7 +3752,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe
TRACE("\n"); TRACE("\n");
/* Allocate initial file properties array */ /* Allocate initial file properties array */
*lpafp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FILEPROPERTIESW)*(sizeFilePropArray)); *lpafp = heap_alloc_zero(sizeof(FILEPROPERTIESW)*(sizeFilePropArray));
if (!*lpafp) if (!*lpafp)
return FALSE; return FALSE;

View File

@ -377,7 +377,7 @@ static const data_stream_vtbl_t gzip_stream_vtbl = {
static voidpf wininet_zalloc(voidpf opaque, uInt items, uInt size) static voidpf wininet_zalloc(voidpf opaque, uInt items, uInt size)
{ {
return HeapAlloc(GetProcessHeap(), 0, items*size); return heap_alloc(items*size);
} }
static void wininet_zfree(voidpf opaque, voidpf address) static void wininet_zfree(voidpf opaque, voidpf address)
@ -465,7 +465,7 @@ static LPWSTR * HTTP_Tokenize(LPCWSTR string, LPCWSTR token_string)
} }
/* add 1 for terminating NULL */ /* add 1 for terminating NULL */
token_array = HeapAlloc(GetProcessHeap(), 0, (tokens+1) * sizeof(*token_array)); token_array = heap_alloc((tokens+1) * sizeof(*token_array));
token_array[tokens] = NULL; token_array[tokens] = NULL;
if (!tokens) if (!tokens)
return token_array; return token_array;
@ -475,7 +475,7 @@ static LPWSTR * HTTP_Tokenize(LPCWSTR string, LPCWSTR token_string)
next_token = strstrW(string, token_string); next_token = strstrW(string, token_string);
if (!next_token) next_token = string+strlenW(string); if (!next_token) next_token = string+strlenW(string);
len = next_token - string; len = next_token - string;
token_array[i] = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); token_array[i] = heap_alloc((len+1)*sizeof(WCHAR));
memcpy(token_array[i], string, len*sizeof(WCHAR)); memcpy(token_array[i], string, len*sizeof(WCHAR));
token_array[i][len] = '\0'; token_array[i][len] = '\0';
string = next_token+strlenW(token_string); string = next_token+strlenW(token_string);
@ -523,8 +523,7 @@ static void HTTP_FixURL(http_request_t *request)
request->path, strlenW(request->path), szHttp, strlenW(szHttp) ) request->path, strlenW(request->path), szHttp, strlenW(szHttp) )
&& request->path[0] != '/') /* not an absolute path ?? --> fix it !! */ && request->path[0] != '/') /* not an absolute path ?? --> fix it !! */
{ {
WCHAR *fixurl = HeapAlloc(GetProcessHeap(), 0, WCHAR *fixurl = heap_alloc((strlenW(request->path) + 2)*sizeof(WCHAR));
(strlenW(request->path) + 2)*sizeof(WCHAR));
*fixurl = '/'; *fixurl = '/';
strcpyW(fixurl + 1, request->path); strcpyW(fixurl + 1, request->path);
HeapFree( GetProcessHeap(), 0, request->path ); HeapFree( GetProcessHeap(), 0, request->path );
@ -546,7 +545,7 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *request, LPCWSTR ve
/* allocate space for an array of all the string pointers to be added */ /* allocate space for an array of all the string pointers to be added */
len = (request->nCustHeaders)*4 + 10; len = (request->nCustHeaders)*4 + 10;
req = HeapAlloc( GetProcessHeap(), 0, len*sizeof(LPCWSTR) ); req = heap_alloc(len*sizeof(LPCWSTR));
/* add the verb, path and HTTP version string */ /* add the verb, path and HTTP version string */
n = 0; n = 0;
@ -610,7 +609,7 @@ static void HTTP_ProcessCookies( http_request_t *request )
Host = HTTP_GetHeader(request, hostW); Host = HTTP_GetHeader(request, hostW);
len = lstrlenW(Host->lpszValue) + 9 + lstrlenW(request->path); len = lstrlenW(Host->lpszValue) + 9 + lstrlenW(request->path);
buf_url = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); buf_url = heap_alloc(len*sizeof(WCHAR));
sprintfW(buf_url, szFmt, Host->lpszValue, request->path); sprintfW(buf_url, szFmt, Host->lpszValue, request->path);
InternetSetCookieW(buf_url, NULL, setCookieHeader->lpszValue); InternetSetCookieW(buf_url, NULL, setCookieHeader->lpszValue);
@ -702,7 +701,7 @@ static UINT retrieve_cached_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR
if (!strcmpiW(host,ad->host) && !strcmpW(realm,ad->realm)) if (!strcmpiW(host,ad->host) && !strcmpW(realm,ad->realm))
{ {
TRACE("Authorization found in cache\n"); TRACE("Authorization found in cache\n");
*auth_data = HeapAlloc(GetProcessHeap(),0,ad->authorizationLen); *auth_data = heap_alloc(ad->authorizationLen);
memcpy(*auth_data,ad->authorization,ad->authorizationLen); memcpy(*auth_data,ad->authorization,ad->authorizationLen);
rc = ad->authorizationLen; rc = ad->authorizationLen;
break; break;
@ -734,16 +733,16 @@ static void cache_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR auth_data
{ {
TRACE("Found match in cache, replacing\n"); TRACE("Found match in cache, replacing\n");
HeapFree(GetProcessHeap(),0,ad->authorization); HeapFree(GetProcessHeap(),0,ad->authorization);
ad->authorization = HeapAlloc(GetProcessHeap(),0,auth_data_len); ad->authorization = heap_alloc(auth_data_len);
memcpy(ad->authorization, auth_data, auth_data_len); memcpy(ad->authorization, auth_data, auth_data_len);
ad->authorizationLen = auth_data_len; ad->authorizationLen = auth_data_len;
} }
else else
{ {
ad = HeapAlloc(GetProcessHeap(),0,sizeof(basicAuthorizationData)); ad = heap_alloc(sizeof(basicAuthorizationData));
ad->host = heap_strdupW(host); ad->host = heap_strdupW(host);
ad->host = heap_strdupW(realm); ad->host = heap_strdupW(realm);
ad->authorization = HeapAlloc(GetProcessHeap(),0,auth_data_len); ad->authorization = heap_alloc(auth_data_len);
memcpy(ad->authorization, auth_data, auth_data_len); memcpy(ad->authorization, auth_data, auth_data_len);
ad->authorizationLen = auth_data_len; ad->authorizationLen = auth_data_len;
list_add_head(&basicAuthorizationCache,&ad->entry); list_add_head(&basicAuthorizationCache,&ad->entry);
@ -766,7 +765,7 @@ static BOOL retrieve_cached_authorization(LPWSTR host, LPWSTR scheme,
nt_auth_identity->User = heap_strdupW(ad->user); nt_auth_identity->User = heap_strdupW(ad->user);
nt_auth_identity->Password = heap_strdupW(ad->password); nt_auth_identity->Password = heap_strdupW(ad->password);
nt_auth_identity->Domain = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*ad->domain_len); nt_auth_identity->Domain = heap_alloc(sizeof(WCHAR)*ad->domain_len);
if(!nt_auth_identity->User || !nt_auth_identity->Password || if(!nt_auth_identity->User || !nt_auth_identity->Password ||
(!nt_auth_identity->Domain && ad->domain_len)) { (!nt_auth_identity->Domain && ad->domain_len)) {
HeapFree(GetProcessHeap(), 0, nt_auth_identity->User); HeapFree(GetProcessHeap(), 0, nt_auth_identity->User);
@ -809,7 +808,7 @@ static void cache_authorization(LPWSTR host, LPWSTR scheme,
HeapFree(GetProcessHeap(), 0, ad->password); HeapFree(GetProcessHeap(), 0, ad->password);
HeapFree(GetProcessHeap(), 0, ad->domain); HeapFree(GetProcessHeap(), 0, ad->domain);
} else { } else {
ad = HeapAlloc(GetProcessHeap(), 0, sizeof(authorizationData)); ad = heap_alloc(sizeof(authorizationData));
if(!ad) { if(!ad) {
LeaveCriticalSection(&authcache_cs); LeaveCriticalSection(&authcache_cs);
return; return;
@ -858,7 +857,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
TimeStamp exp; TimeStamp exp;
first = TRUE; first = TRUE;
pAuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*pAuthInfo)); pAuthInfo = heap_alloc(sizeof(*pAuthInfo));
if (!pAuthInfo) if (!pAuthInfo)
return FALSE; return FALSE;
@ -993,7 +992,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
passlen = WideCharToMultiByte(CP_UTF8, 0, password, lstrlenW(password), NULL, 0, NULL, NULL); passlen = WideCharToMultiByte(CP_UTF8, 0, password, lstrlenW(password), NULL, 0, NULL, NULL);
/* length includes a nul terminator, which will be re-used for the ':' */ /* length includes a nul terminator, which will be re-used for the ':' */
auth_data = HeapAlloc(GetProcessHeap(), 0, userlen + 1 + passlen); auth_data = heap_alloc(userlen + 1 + passlen);
if (!auth_data) if (!auth_data)
{ {
HeapFree(GetProcessHeap(),0,szRealm); HeapFree(GetProcessHeap(),0,szRealm);
@ -1037,11 +1036,11 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
{ {
pszAuthData++; pszAuthData++;
in.cbBuffer = HTTP_DecodeBase64(pszAuthData, NULL); in.cbBuffer = HTTP_DecodeBase64(pszAuthData, NULL);
in.pvBuffer = HeapAlloc(GetProcessHeap(), 0, in.cbBuffer); in.pvBuffer = heap_alloc(in.cbBuffer);
HTTP_DecodeBase64(pszAuthData, in.pvBuffer); HTTP_DecodeBase64(pszAuthData, in.pvBuffer);
} }
buffer = HeapAlloc(GetProcessHeap(), 0, pAuthInfo->max_token); buffer = heap_alloc(pAuthInfo->max_token);
out.BufferType = SECBUFFER_TOKEN; out.BufferType = SECBUFFER_TOKEN;
out.cbBuffer = pAuthInfo->max_token; out.cbBuffer = pAuthInfo->max_token;
@ -1101,7 +1100,7 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *request,
len = strlenW(lpszHeader); len = strlenW(lpszHeader);
else else
len = dwHeaderLength; len = dwHeaderLength;
buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR)*(len+1) ); buffer = heap_alloc(sizeof(WCHAR)*(len+1));
lstrcpynW( buffer, lpszHeader, len + 1); lstrcpynW( buffer, lpszHeader, len + 1);
lpszStart = buffer; lpszStart = buffer;
@ -1211,7 +1210,7 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest,
TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_an(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier); TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_an(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier);
len = MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, NULL, 0 ); len = MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, NULL, 0 );
hdr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); hdr = heap_alloc(len*sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, hdr, len ); MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, hdr, len );
if( dwHeaderLength != ~0U ) if( dwHeaderLength != ~0U )
dwHeaderLength = len; dwHeaderLength = len;
@ -1299,7 +1298,7 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
__ENDTRY; __ENDTRY;
types++; types++;
} }
szAcceptTypes = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR *) * (acceptTypesCount+1)); szAcceptTypes = heap_alloc(sizeof(WCHAR *) * (acceptTypesCount+1));
if (!szAcceptTypes) goto end; if (!szAcceptTypes) goto end;
acceptTypesCount = 0; acceptTypesCount = 0;
@ -1494,7 +1493,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
{ {
/* scheme + space + base64 encoded data (3/2/1 bytes data -> 4 bytes of characters) */ /* scheme + space + base64 encoded data (3/2/1 bytes data -> 4 bytes of characters) */
len = strlenW(pAuthInfo->scheme)+1+((pAuthInfo->auth_data_len+2)*4)/3; len = strlenW(pAuthInfo->scheme)+1+((pAuthInfo->auth_data_len+2)*4)/3;
authorization = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); authorization = heap_alloc((len+1)*sizeof(WCHAR));
if (!authorization) if (!authorization)
return FALSE; return FALSE;
@ -1532,7 +1531,7 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
size = sizeof(new_location); size = sizeof(new_location);
if (HTTP_HttpQueryInfoW(req, HTTP_QUERY_LOCATION, new_location, &size, NULL) == ERROR_SUCCESS) if (HTTP_HttpQueryInfoW(req, HTTP_QUERY_LOCATION, new_location, &size, NULL) == ERROR_SUCCESS)
{ {
if (!(url = HeapAlloc( GetProcessHeap(), 0, size + sizeof(WCHAR) ))) return NULL; if (!(url = heap_alloc(size + sizeof(WCHAR)))) return NULL;
strcpyW( url, new_location ); strcpyW( url, new_location );
} }
else else
@ -1545,7 +1544,7 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
size = 16; /* "https://" + sizeof(port#) + ":/\0" */ size = 16; /* "https://" + sizeof(port#) + ":/\0" */
size += strlenW( session->hostName ) + strlenW( req->path ); size += strlenW( session->hostName ) + strlenW( req->path );
if (!(url = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) return NULL; if (!(url = heap_alloc(size * sizeof(WCHAR)))) return NULL;
if (req->hdr.dwFlags & INTERNET_FLAG_SECURE) if (req->hdr.dwFlags & INTERNET_FLAG_SECURE)
sprintfW( url, formatSSL, session->hostName, session->hostPort ); sprintfW( url, formatSSL, session->hostName, session->hostPort );
@ -1889,7 +1888,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
error = GetLastError(); error = GetLastError();
if (!ret && error == ERROR_INSUFFICIENT_BUFFER) if (!ret && error == ERROR_INSUFFICIENT_BUFFER)
{ {
if (!(info = HeapAlloc(GetProcessHeap(), 0, nbytes))) if (!(info = heap_alloc(nbytes)))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
GetUrlCacheEntryInfoW(url, info, &nbytes); GetUrlCacheEntryInfoW(url, info, &nbytes);
@ -2822,8 +2821,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
request->session = session; request->session = session;
list_add_head( &session->hdr.children, &request->hdr.entry ); list_add_head( &session->hdr.children, &request->hdr.entry );
lpszHostName = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * lpszHostName = heap_alloc(sizeof(WCHAR) * (strlenW(session->hostName) + 7 /* length of ":65535" + 1 */));
(strlenW(session->hostName) + 7 /* length of ":65535" + 1 */));
if (NULL == lpszHostName) if (NULL == lpszHostName)
{ {
res = ERROR_OUTOFMEMORY; res = ERROR_OUTOFMEMORY;
@ -2844,7 +2842,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
rc = UrlEscapeW(lpszObjectName, NULL, &len, URL_ESCAPE_SPACES_ONLY); rc = UrlEscapeW(lpszObjectName, NULL, &len, URL_ESCAPE_SPACES_ONLY);
if (rc != E_POINTER) if (rc != E_POINTER)
len = strlenW(lpszObjectName)+1; len = strlenW(lpszObjectName)+1;
request->path = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); request->path = heap_alloc(len*sizeof(WCHAR));
rc = UrlEscapeW(lpszObjectName, request->path, &len, rc = UrlEscapeW(lpszObjectName, request->path, &len,
URL_ESCAPE_SPACES_ONLY); URL_ESCAPE_SPACES_ONLY);
if (rc != S_OK) if (rc != S_OK)
@ -3455,7 +3453,7 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
} }
else else
alloclen = len; alloclen = len;
bufferW = HeapAlloc( GetProcessHeap(), 0, alloclen ); bufferW = heap_alloc(alloclen);
/* buffer is in/out because of HTTP_QUERY_CUSTOM */ /* buffer is in/out because of HTTP_QUERY_CUSTOM */
if ((dwInfoLevel & HTTP_QUERY_HEADER_MASK) == HTTP_QUERY_CUSTOM) if ((dwInfoLevel & HTTP_QUERY_HEADER_MASK) == HTTP_QUERY_CUSTOM)
MultiByteToWideChar( CP_ACP, 0, lpBuffer, -1, bufferW, alloclen / sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, lpBuffer, -1, bufferW, alloclen / sizeof(WCHAR) );
@ -3518,7 +3516,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
(GetLastError() != ERROR_INSUFFICIENT_BUFFER)) (GetLastError() != ERROR_INSUFFICIENT_BUFFER))
return NULL; return NULL;
orig_url = HeapAlloc(GetProcessHeap(), 0, url_length); orig_url = heap_alloc(url_length);
/* convert from bytes to characters */ /* convert from bytes to characters */
url_length = url_length / sizeof(WCHAR) - 1; url_length = url_length / sizeof(WCHAR) - 1;
@ -3535,7 +3533,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
HeapFree(GetProcessHeap(), 0, orig_url); HeapFree(GetProcessHeap(), 0, orig_url);
return NULL; return NULL;
} }
combined_url = HeapAlloc(GetProcessHeap(), 0, url_length * sizeof(WCHAR)); combined_url = heap_alloc(url_length * sizeof(WCHAR));
if (!InternetCombineUrlW(orig_url, lpszUrl, combined_url, &url_length, ICU_ENCODE_SPACES_ONLY)) if (!InternetCombineUrlW(orig_url, lpszUrl, combined_url, &url_length, ICU_ENCODE_SPACES_ONLY))
{ {
@ -3639,7 +3637,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
static const WCHAR fmt[] = {'%','s',':','%','u',0}; static const WCHAR fmt[] = {'%','s',':','%','u',0};
len = lstrlenW(hostName); len = lstrlenW(hostName);
len += 7; /* 5 for strlen("65535") + 1 for ":" + 1 for '\0' */ len += 7; /* 5 for strlen("65535") + 1 for ":" + 1 for '\0' */
session->hostName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); session->hostName = heap_alloc(len*sizeof(WCHAR));
sprintfW(session->hostName, fmt, hostName, urlComponents.nPort); sprintfW(session->hostName, fmt, hostName, urlComponents.nPort);
} }
else else
@ -3687,7 +3685,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
rc = UrlEscapeW(path, NULL, &needed, URL_ESCAPE_SPACES_ONLY); rc = UrlEscapeW(path, NULL, &needed, URL_ESCAPE_SPACES_ONLY);
if (rc != E_POINTER) if (rc != E_POINTER)
needed = strlenW(path)+1; needed = strlenW(path)+1;
request->path = HeapAlloc(GetProcessHeap(), 0, needed*sizeof(WCHAR)); request->path = heap_alloc(needed*sizeof(WCHAR));
rc = UrlEscapeW(path, request->path, &needed, rc = UrlEscapeW(path, request->path, &needed,
URL_ESCAPE_SPACES_ONLY); URL_ESCAPE_SPACES_ONLY);
if (rc != S_OK) if (rc != S_OK)
@ -3722,7 +3720,7 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len )
len += strlenW( *t ); len += strlenW( *t );
len++; len++;
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); str = heap_alloc(len*sizeof(WCHAR));
*str = 0; *str = 0;
for( t = list; *t ; t++ ) for( t = list; *t ; t++ )
@ -3746,7 +3744,7 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *request)
TRACE("\n"); TRACE("\n");
lpszPath = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( session->hostName ) + 13)*sizeof(WCHAR) ); lpszPath = heap_alloc((lstrlenW( session->hostName ) + 13)*sizeof(WCHAR));
sprintfW( lpszPath, szFormat, session->hostName, session->hostPort ); sprintfW( lpszPath, szFormat, session->hostName, session->hostPort );
requestString = HTTP_BuildHeaderRequestString( request, szConnect, lpszPath, g_szHttp1_1 ); requestString = HTTP_BuildHeaderRequestString( request, szConnect, lpszPath, g_szHttp1_1 );
HeapFree( GetProcessHeap(), 0, lpszPath ); HeapFree( GetProcessHeap(), 0, lpszPath );
@ -3754,7 +3752,7 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *request)
len = WideCharToMultiByte( CP_ACP, 0, requestString, -1, len = WideCharToMultiByte( CP_ACP, 0, requestString, -1,
NULL, 0, NULL, NULL ); NULL, 0, NULL, NULL );
len--; /* the nul terminator isn't needed */ len--; /* the nul terminator isn't needed */
ascii_req = HeapAlloc( GetProcessHeap(), 0, len ); ascii_req = heap_alloc(len);
WideCharToMultiByte( CP_ACP, 0, requestString, -1, WideCharToMultiByte( CP_ACP, 0, requestString, -1,
ascii_req, len, NULL, NULL ); ascii_req, len, NULL, NULL );
HeapFree( GetProcessHeap(), 0, requestString ); HeapFree( GetProcessHeap(), 0, requestString );
@ -3781,7 +3779,7 @@ static void HTTP_InsertCookies(http_request_t *request)
LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW); LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW);
size = (strlenW(Host->lpszValue) + strlenW(szUrlForm) + strlenW(request->path)) * sizeof(WCHAR); size = (strlenW(Host->lpszValue) + strlenW(szUrlForm) + strlenW(request->path)) * sizeof(WCHAR);
if (!(lpszUrl = HeapAlloc(GetProcessHeap(), 0, size))) return; if (!(lpszUrl = heap_alloc(size))) return;
sprintfW( lpszUrl, szUrlForm, Host->lpszValue, request->path); sprintfW( lpszUrl, szUrlForm, Host->lpszValue, request->path);
if (InternetGetCookieW(lpszUrl, NULL, NULL, &nCookieSize)) if (InternetGetCookieW(lpszUrl, NULL, NULL, &nCookieSize))
@ -3790,7 +3788,7 @@ static void HTTP_InsertCookies(http_request_t *request)
static const WCHAR szCookie[] = {'C','o','o','k','i','e',':',' ',0}; static const WCHAR szCookie[] = {'C','o','o','k','i','e',':',' ',0};
size = sizeof(szCookie) + nCookieSize * sizeof(WCHAR) + sizeof(szCrLf); size = sizeof(szCookie) + nCookieSize * sizeof(WCHAR) + sizeof(szCrLf);
if ((lpszCookies = HeapAlloc(GetProcessHeap(), 0, size))) if ((lpszCookies = heap_alloc(size)))
{ {
cnt += sprintfW(lpszCookies, szCookie); cnt += sprintfW(lpszCookies, szCookie);
InternetGetCookieW(lpszUrl, NULL, lpszCookies + cnt, &nCookieSize); InternetGetCookieW(lpszUrl, NULL, lpszCookies + cnt, &nCookieSize);
@ -4264,7 +4262,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
int len; int len;
len = strlenW(request->session->appInfo->agent) + strlenW(user_agent); len = strlenW(request->session->appInfo->agent) + strlenW(user_agent);
agent_header = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); agent_header = heap_alloc(len * sizeof(WCHAR));
sprintfW(agent_header, user_agent, request->session->appInfo->agent); sprintfW(agent_header, user_agent, request->session->appInfo->agent);
HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW);
@ -4348,7 +4346,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
dwOptionalLength = 0; dwOptionalLength = 0;
len = WideCharToMultiByte( CP_ACP, 0, requestString, -1, len = WideCharToMultiByte( CP_ACP, 0, requestString, -1,
NULL, 0, NULL, NULL ); NULL, 0, NULL, NULL );
ascii_req = HeapAlloc( GetProcessHeap(), 0, len + dwOptionalLength ); ascii_req = heap_alloc(len + dwOptionalLength);
WideCharToMultiByte( CP_ACP, 0, requestString, -1, WideCharToMultiByte( CP_ACP, 0, requestString, -1,
ascii_req, len, NULL, NULL ); ascii_req, len, NULL, NULL );
if( lpOptional ) if( lpOptional )
@ -4735,7 +4733,7 @@ BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
{ {
headerlen = MultiByteToWideChar(CP_ACP,0,lpBuffersIn->lpcszHeader, headerlen = MultiByteToWideChar(CP_ACP,0,lpBuffersIn->lpcszHeader,
lpBuffersIn->dwHeadersLength,0,0); lpBuffersIn->dwHeadersLength,0,0);
header = HeapAlloc(GetProcessHeap(),0,headerlen*sizeof(WCHAR)); header = heap_alloc(headerlen*sizeof(WCHAR));
if (!(BuffersInW.lpcszHeader = header)) if (!(BuffersInW.lpcszHeader = header))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
@ -4816,7 +4814,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
else else
size = lpBuffersIn->dwHeadersLength * sizeof(WCHAR); size = lpBuffersIn->dwHeadersLength * sizeof(WCHAR);
req->lpszHeader = HeapAlloc( GetProcessHeap(), 0, size ); req->lpszHeader = heap_alloc(size);
memcpy( req->lpszHeader, lpBuffersIn->lpcszHeader, size ); memcpy( req->lpszHeader, lpBuffersIn->lpcszHeader, size );
} }
else req->lpszHeader = NULL; else req->lpszHeader = NULL;
@ -4919,7 +4917,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
if (dwHeaderLength == ~0u) size = (strlenW(lpszHeaders) + 1) * sizeof(WCHAR); if (dwHeaderLength == ~0u) size = (strlenW(lpszHeaders) + 1) * sizeof(WCHAR);
else size = dwHeaderLength * sizeof(WCHAR); else size = dwHeaderLength * sizeof(WCHAR);
req->lpszHeader = HeapAlloc(GetProcessHeap(), 0, size); req->lpszHeader = heap_alloc(size);
memcpy(req->lpszHeader, lpszHeaders, size); memcpy(req->lpszHeader, lpszHeaders, size);
} }
else else
@ -4969,7 +4967,7 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
if(lpszHeaders!=NULL) if(lpszHeaders!=NULL)
{ {
nLen=MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,NULL,0); nLen=MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,NULL,0);
szHeaders=HeapAlloc(GetProcessHeap(),0,nLen*sizeof(WCHAR)); szHeaders = heap_alloc(nLen*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,szHeaders,nLen); MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,szHeaders,nLen);
} }
result=HttpSendRequestW(hHttpRequest, szHeaders, nLen, lpOptional, dwOptionalLength); result=HttpSendRequestW(hHttpRequest, szHeaders, nLen, lpOptional, dwOptionalLength);
@ -5356,7 +5354,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
*(status_text-1) = ' '; *(status_text-1) = ' ';
/* regenerate raw headers */ /* regenerate raw headers */
lpszRawHeaders = HeapAlloc(GetProcessHeap(), 0, (cchMaxRawHeaders + 1) * sizeof(WCHAR)); lpszRawHeaders = heap_alloc((cchMaxRawHeaders + 1) * sizeof(WCHAR));
if (!lpszRawHeaders) goto lend; if (!lpszRawHeaders) goto lend;
while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders) while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders)
@ -5457,7 +5455,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
LPWSTR pszColon; LPWSTR pszColon;
INT len; INT len;
pTokenPair = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pTokenPair)*3); pTokenPair = heap_alloc_zero(sizeof(*pTokenPair)*3);
pszColon = strchrW(buffer, ':'); pszColon = strchrW(buffer, ':');
/* must have two tokens */ /* must have two tokens */
@ -5469,7 +5467,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
return NULL; return NULL;
} }
pTokenPair[0] = HeapAlloc(GetProcessHeap(), 0, (pszColon - buffer + 1) * sizeof(WCHAR)); pTokenPair[0] = heap_alloc((pszColon - buffer + 1) * sizeof(WCHAR));
if (!pTokenPair[0]) if (!pTokenPair[0])
{ {
HTTP_FreeTokens(pTokenPair); HTTP_FreeTokens(pTokenPair);
@ -5481,7 +5479,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
/* skip colon */ /* skip colon */
pszColon++; pszColon++;
len = strlenW(pszColon); len = strlenW(pszColon);
pTokenPair[1] = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); pTokenPair[1] = heap_alloc((len + 1) * sizeof(WCHAR));
if (!pTokenPair[1]) if (!pTokenPair[1])
{ {
HTTP_FreeTokens(pTokenPair); HTTP_FreeTokens(pTokenPair);
@ -5696,7 +5694,7 @@ static DWORD HTTP_InsertCustomHeader(http_request_t *request, LPHTTPHEADERW lpHd
if (count > 1) if (count > 1)
lph = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, request->custHeaders, sizeof(HTTPHEADERW) * count); lph = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, request->custHeaders, sizeof(HTTPHEADERW) * count);
else else
lph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HTTPHEADERW) * count); lph = heap_alloc_zero(sizeof(HTTPHEADERW) * count);
if (!lph) if (!lph)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;

View File

@ -543,7 +543,7 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi )
LPWSTR szProxy, p; LPWSTR szProxy, p;
static const WCHAR szHttp[] = {'h','t','t','p','=',0}; static const WCHAR szHttp[] = {'h','t','t','p','=',0};
if (!(szProxy = HeapAlloc( GetProcessHeap(), 0, len ))) if (!(szProxy = heap_alloc(len)))
{ {
RegCloseKey( key ); RegCloseKey( key );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
@ -575,7 +575,7 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi )
WCHAR *envproxyW; WCHAR *envproxyW;
len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 ); len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
if (!(envproxyW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR)))) if (!(envproxyW = heap_alloc(len * sizeof(WCHAR))))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len ); MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
@ -1085,7 +1085,7 @@ BOOL WINAPI InternetGetConnectedStateExA(LPDWORD lpdwStatus, LPSTR lpszConnectio
TRACE("(%p, %p, %d, 0x%08x)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved); TRACE("(%p, %p, %d, 0x%08x)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved);
if (lpszConnectionName && dwNameLen > 0) if (lpszConnectionName && dwNameLen > 0)
lpwszConnectionName= HeapAlloc(GetProcessHeap(), 0, dwNameLen * sizeof(WCHAR)); lpwszConnectionName = heap_alloc(dwNameLen * sizeof(WCHAR));
rc = InternetGetConnectedStateExW(lpdwStatus,lpwszConnectionName, dwNameLen, rc = InternetGetConnectedStateExW(lpdwStatus,lpwszConnectionName, dwNameLen,
dwReserved); dwReserved);
@ -1357,7 +1357,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
InternetCrackUrlW should not include it */ InternetCrackUrlW should not include it */
if (dwUrlLength == -1) nLength--; if (dwUrlLength == -1) nLength--;
lpwszUrl = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(WCHAR)); lpwszUrl = heap_alloc((nLength + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength + 1); MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength + 1);
lpwszUrl[nLength] = '\0'; lpwszUrl[nLength] = '\0';
@ -1368,7 +1368,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
UCW.dwHostNameLength = lpUrlComponents->dwHostNameLength; UCW.dwHostNameLength = lpUrlComponents->dwHostNameLength;
if (lpUrlComponents->lpszHostName) if (lpUrlComponents->lpszHostName)
{ {
hostname = HeapAlloc(GetProcessHeap(), 0, UCW.dwHostNameLength * sizeof(WCHAR)); hostname = heap_alloc(UCW.dwHostNameLength * sizeof(WCHAR));
UCW.lpszHostName = hostname; UCW.lpszHostName = hostname;
} }
} }
@ -1377,7 +1377,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
UCW.dwUserNameLength = lpUrlComponents->dwUserNameLength; UCW.dwUserNameLength = lpUrlComponents->dwUserNameLength;
if (lpUrlComponents->lpszUserName) if (lpUrlComponents->lpszUserName)
{ {
username = HeapAlloc(GetProcessHeap(), 0, UCW.dwUserNameLength * sizeof(WCHAR)); username = heap_alloc(UCW.dwUserNameLength * sizeof(WCHAR));
UCW.lpszUserName = username; UCW.lpszUserName = username;
} }
} }
@ -1386,7 +1386,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
UCW.dwPasswordLength = lpUrlComponents->dwPasswordLength; UCW.dwPasswordLength = lpUrlComponents->dwPasswordLength;
if (lpUrlComponents->lpszPassword) if (lpUrlComponents->lpszPassword)
{ {
password = HeapAlloc(GetProcessHeap(), 0, UCW.dwPasswordLength * sizeof(WCHAR)); password = heap_alloc(UCW.dwPasswordLength * sizeof(WCHAR));
UCW.lpszPassword = password; UCW.lpszPassword = password;
} }
} }
@ -1395,7 +1395,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
UCW.dwUrlPathLength = lpUrlComponents->dwUrlPathLength; UCW.dwUrlPathLength = lpUrlComponents->dwUrlPathLength;
if (lpUrlComponents->lpszUrlPath) if (lpUrlComponents->lpszUrlPath)
{ {
path = HeapAlloc(GetProcessHeap(), 0, UCW.dwUrlPathLength * sizeof(WCHAR)); path = heap_alloc(UCW.dwUrlPathLength * sizeof(WCHAR));
UCW.lpszUrlPath = path; UCW.lpszUrlPath = path;
} }
} }
@ -1404,7 +1404,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
UCW.dwSchemeLength = lpUrlComponents->dwSchemeLength; UCW.dwSchemeLength = lpUrlComponents->dwSchemeLength;
if (lpUrlComponents->lpszScheme) if (lpUrlComponents->lpszScheme)
{ {
scheme = HeapAlloc(GetProcessHeap(), 0, UCW.dwSchemeLength * sizeof(WCHAR)); scheme = heap_alloc(UCW.dwSchemeLength * sizeof(WCHAR));
UCW.lpszScheme = scheme; UCW.lpszScheme = scheme;
} }
} }
@ -1413,7 +1413,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
UCW.dwExtraInfoLength = lpUrlComponents->dwExtraInfoLength; UCW.dwExtraInfoLength = lpUrlComponents->dwExtraInfoLength;
if (lpUrlComponents->lpszExtraInfo) if (lpUrlComponents->lpszExtraInfo)
{ {
extra = HeapAlloc(GetProcessHeap(), 0, UCW.dwExtraInfoLength * sizeof(WCHAR)); extra = heap_alloc(UCW.dwExtraInfoLength * sizeof(WCHAR));
UCW.lpszExtraInfo = extra; UCW.lpszExtraInfo = extra;
} }
} }
@ -1572,14 +1572,14 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
WCHAR *url_tmp; WCHAR *url_tmp;
DWORD len = dwUrlLength + 1; DWORD len = dwUrlLength + 1;
if (!(url_tmp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) if (!(url_tmp = heap_alloc(len * sizeof(WCHAR))))
{ {
INTERNET_SetLastError(ERROR_OUTOFMEMORY); INTERNET_SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
} }
memcpy(url_tmp, lpszUrl_orig, dwUrlLength * sizeof(WCHAR)); memcpy(url_tmp, lpszUrl_orig, dwUrlLength * sizeof(WCHAR));
url_tmp[dwUrlLength] = 0; url_tmp[dwUrlLength] = 0;
if (!(lpszUrl_decode = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) if (!(lpszUrl_decode = heap_alloc(len * sizeof(WCHAR))))
{ {
HeapFree(GetProcessHeap(), 0, url_tmp); HeapFree(GetProcessHeap(), 0, url_tmp);
INTERNET_SetLastError(ERROR_OUTOFMEMORY); INTERNET_SetLastError(ERROR_OUTOFMEMORY);
@ -2771,7 +2771,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0); proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0);
prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0); prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0);
wlen = sizeof(*piw) + proxlen + prbylen; wlen = sizeof(*piw) + proxlen + prbylen;
wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); wbuffer = heap_alloc(wlen*sizeof(WCHAR) );
piw = (LPINTERNET_PROXY_INFOW) wbuffer; piw = (LPINTERNET_PROXY_INFOW) wbuffer;
piw->dwAccessType = pi->dwAccessType; piw->dwAccessType = pi->dwAccessType;
prox = (LPWSTR) &piw[1]; prox = (LPWSTR) &piw[1];
@ -2787,7 +2787,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
case INTERNET_OPTION_PASSWORD: case INTERNET_OPTION_PASSWORD:
wlen = MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength, wlen = MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength,
NULL, 0 ); NULL, 0 );
wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); wbuffer = heap_alloc(wlen*sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength, MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength,
wbuffer, wlen ); wbuffer, wlen );
break; break;
@ -2796,21 +2796,21 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
INTERNET_PER_CONN_OPTION_LISTW *listW; INTERNET_PER_CONN_OPTION_LISTW *listW;
INTERNET_PER_CONN_OPTION_LISTA *listA = lpBuffer; INTERNET_PER_CONN_OPTION_LISTA *listA = lpBuffer;
wlen = sizeof(INTERNET_PER_CONN_OPTION_LISTW); wlen = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen ); wbuffer = heap_alloc(wlen);
listW = wbuffer; listW = wbuffer;
listW->dwSize = sizeof(INTERNET_PER_CONN_OPTION_LISTW); listW->dwSize = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
if (listA->pszConnection) if (listA->pszConnection)
{ {
wlen = MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, NULL, 0 ); wlen = MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, NULL, 0 );
listW->pszConnection = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); listW->pszConnection = heap_alloc(wlen*sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, listW->pszConnection, wlen ); MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, listW->pszConnection, wlen );
} }
else else
listW->pszConnection = NULL; listW->pszConnection = NULL;
listW->dwOptionCount = listA->dwOptionCount; listW->dwOptionCount = listA->dwOptionCount;
listW->dwOptionError = listA->dwOptionError; listW->dwOptionError = listA->dwOptionError;
listW->pOptions = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW) * listA->dwOptionCount ); listW->pOptions = heap_alloc(sizeof(INTERNET_PER_CONN_OPTIONW) * listA->dwOptionCount);
for (i = 0; i < listA->dwOptionCount; ++i) { for (i = 0; i < listA->dwOptionCount; ++i) {
INTERNET_PER_CONN_OPTIONA *optA = listA->pOptions + i; INTERNET_PER_CONN_OPTIONA *optA = listA->pOptions + i;
@ -2827,7 +2827,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
if (optA->Value.pszValue) if (optA->Value.pszValue)
{ {
wlen = MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, NULL, 0 ); wlen = MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, NULL, 0 );
optW->Value.pszValue = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); optW->Value.pszValue = heap_alloc(wlen*sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, optW->Value.pszValue, wlen ); MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, optW->Value.pszValue, wlen );
} }
else else
@ -3162,7 +3162,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
* Build our ping command * Build our ping command
*/ */
len = WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, NULL, 0, NULL, NULL);
command = HeapAlloc( GetProcessHeap(), 0, strlen(ping)+len+strlen(redirect) ); command = heap_alloc(strlen(ping)+len+strlen(redirect));
strcpy(command,ping); strcpy(command,ping);
WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, command+strlen(ping), len, NULL, NULL); WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, command+strlen(ping), len, NULL, NULL);
strcat(command,redirect); strcat(command,redirect);
@ -3290,7 +3290,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
WCHAR *path_extra; WCHAR *path_extra;
DWORD len = urlComponents.dwUrlPathLength + urlComponents.dwExtraInfoLength + 1; DWORD len = urlComponents.dwUrlPathLength + urlComponents.dwExtraInfoLength + 1;
if (!(path_extra = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) if (!(path_extra = heap_alloc(len * sizeof(WCHAR))))
{ {
InternetCloseHandle(client); InternetCloseHandle(client);
break; break;
@ -3430,7 +3430,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
if(lpszHeaders) { if(lpszHeaders) {
lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 ); lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 );
szHeaders = HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(WCHAR)); szHeaders = heap_alloc(lenHeaders*sizeof(WCHAR));
if(!szHeaders) { if(!szHeaders) {
HeapFree(GetProcessHeap(), 0, szUrl); HeapFree(GetProcessHeap(), 0, szUrl);
return NULL; return NULL;
@ -3450,7 +3450,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
static LPWITHREADERROR INTERNET_AllocThreadError(void) static LPWITHREADERROR INTERNET_AllocThreadError(void)
{ {
LPWITHREADERROR lpwite = HeapAlloc(GetProcessHeap(), 0, sizeof(*lpwite)); LPWITHREADERROR lpwite = heap_alloc(sizeof(*lpwite));
if (lpwite) if (lpwite)
{ {
@ -3552,7 +3552,7 @@ DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
TRACE("\n"); TRACE("\n");
lpNewRequest = HeapAlloc(GetProcessHeap(), 0, sizeof(WORKREQUEST)); lpNewRequest = heap_alloc(sizeof(WORKREQUEST));
if (!lpNewRequest) if (!lpNewRequest)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
@ -3946,7 +3946,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszScheme) if (lpUrlComponents->lpszScheme)
{ {
len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1;
urlCompW->lpszScheme = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszScheme = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme,
-1, urlCompW->lpszScheme, len); -1, urlCompW->lpszScheme, len);
} }
@ -3954,7 +3954,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszHostName) if (lpUrlComponents->lpszHostName)
{ {
len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1;
urlCompW->lpszHostName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszHostName = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName,
-1, urlCompW->lpszHostName, len); -1, urlCompW->lpszHostName, len);
} }
@ -3962,7 +3962,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszUserName) if (lpUrlComponents->lpszUserName)
{ {
len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1;
urlCompW->lpszUserName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszUserName = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName,
-1, urlCompW->lpszUserName, len); -1, urlCompW->lpszUserName, len);
} }
@ -3970,7 +3970,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszPassword) if (lpUrlComponents->lpszPassword)
{ {
len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1;
urlCompW->lpszPassword = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszPassword = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword,
-1, urlCompW->lpszPassword, len); -1, urlCompW->lpszPassword, len);
} }
@ -3978,7 +3978,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszUrlPath) if (lpUrlComponents->lpszUrlPath)
{ {
len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1;
urlCompW->lpszUrlPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszUrlPath = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath,
-1, urlCompW->lpszUrlPath, len); -1, urlCompW->lpszUrlPath, len);
} }
@ -3986,7 +3986,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszExtraInfo) if (lpUrlComponents->lpszExtraInfo)
{ {
len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1;
urlCompW->lpszExtraInfo = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszExtraInfo = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo,
-1, urlCompW->lpszExtraInfo, len); -1, urlCompW->lpszExtraInfo, len);
} }
@ -4015,7 +4015,7 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
convert_urlcomp_atow(lpUrlComponents, &urlCompW); convert_urlcomp_atow(lpUrlComponents, &urlCompW);
if (lpszUrl) if (lpszUrl)
urlW = HeapAlloc(GetProcessHeap(), 0, *lpdwUrlLength * sizeof(WCHAR)); urlW = heap_alloc(*lpdwUrlLength * sizeof(WCHAR));
ret = InternetCreateUrlW(&urlCompW, dwFlags, urlW, lpdwUrlLength); ret = InternetCreateUrlW(&urlCompW, dwFlags, urlW, lpdwUrlLength);

View File

@ -91,7 +91,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
DWORD size; DWORD size;
size = (strlenW(str)+1)*sizeof(WCHAR); size = (strlenW(str)+1)*sizeof(WCHAR);
ret = HeapAlloc(GetProcessHeap(), 0, size); ret = heap_alloc(size);
if(ret) if(ret)
memcpy(ret, str, size); memcpy(ret, str, size);
} }
@ -111,7 +111,7 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, UINT max_len)
if(str[len] == '\0') if(str[len] == '\0')
break; break;
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(len+1)); ret = heap_alloc(sizeof(WCHAR)*(len+1));
if(ret) { if(ret) {
memcpy(ret, str, sizeof(WCHAR)*len); memcpy(ret, str, sizeof(WCHAR)*len);
ret[len] = '\0'; ret[len] = '\0';
@ -128,7 +128,7 @@ static inline WCHAR *heap_strdupAtoW(const char *str)
DWORD len; DWORD len;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); ret = heap_alloc(len*sizeof(WCHAR));
if(ret) if(ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
} }
@ -142,7 +142,7 @@ static inline char *heap_strdupWtoA(LPCWSTR str)
if(str) { if(str) {
DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ret = HeapAlloc(GetProcessHeap(), 0, size); ret = heap_alloc(size);
if(ret) if(ret)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
} }

View File

@ -201,7 +201,7 @@ static PCCERT_CONTEXT X509_to_cert_context(X509 *cert)
*/ */
if (!p) if (!p)
{ {
buffer = HeapAlloc(GetProcessHeap(),0,len); buffer = heap_alloc(len);
p = buffer; p = buffer;
len = pi2d_X509(cert,&p); len = pi2d_X509(cert,&p);
} }

View File

@ -454,7 +454,7 @@ static void URLCacheContainer_CloseIndex(URLCACHECONTAINER * pContainer)
static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path, LPWSTR mutex_name) static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path, LPWSTR mutex_name)
{ {
URLCACHECONTAINER * pContainer = HeapAlloc(GetProcessHeap(), 0, sizeof(URLCACHECONTAINER)); URLCACHECONTAINER * pContainer = heap_alloc(sizeof(URLCACHECONTAINER));
int cache_prefix_len = strlenW(cache_prefix); int cache_prefix_len = strlenW(cache_prefix);
if (!pContainer) if (!pContainer)
@ -472,7 +472,7 @@ static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path,
return FALSE; return FALSE;
} }
pContainer->cache_prefix = HeapAlloc(GetProcessHeap(), 0, (cache_prefix_len + 1) * sizeof(WCHAR)); pContainer->cache_prefix = heap_alloc((cache_prefix_len + 1) * sizeof(WCHAR));
if (!pContainer->cache_prefix) if (!pContainer->cache_prefix)
{ {
HeapFree(GetProcessHeap(), 0, pContainer->path); HeapFree(GetProcessHeap(), 0, pContainer->path);
@ -3001,7 +3001,7 @@ HANDLE WINAPI RetrieveUrlCacheEntryStreamA(
return FALSE; return FALSE;
/* allocate handle storage space */ /* allocate handle storage space */
pStream = HeapAlloc(GetProcessHeap(), 0, sizeof(STREAM_HANDLE) + strlen(lpszUrlName) * sizeof(CHAR)); pStream = heap_alloc(sizeof(STREAM_HANDLE) + strlen(lpszUrlName) * sizeof(CHAR));
if (!pStream) if (!pStream)
{ {
CloseHandle(hFile); CloseHandle(hFile);
@ -3062,7 +3062,7 @@ HANDLE WINAPI RetrieveUrlCacheEntryStreamW(
size = sizeof(STREAM_HANDLE); size = sizeof(STREAM_HANDLE);
url_len = WideCharToMultiByte(CP_ACP, 0, lpszUrlName, -1, NULL, 0, NULL, NULL); url_len = WideCharToMultiByte(CP_ACP, 0, lpszUrlName, -1, NULL, 0, NULL, NULL);
size += url_len; size += url_len;
pStream = HeapAlloc(GetProcessHeap(), 0, size); pStream = heap_alloc(size);
if (!pStream) if (!pStream)
{ {
CloseHandle(hFile); CloseHandle(hFile);
@ -3349,7 +3349,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern,
TRACE("(%s, %p, %p)\n", debugstr_a(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize); TRACE("(%s, %p, %p)\n", debugstr_a(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize);
pEntryHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEntryHandle)); pEntryHandle = heap_alloc(sizeof(*pEntryHandle));
if (!pEntryHandle) if (!pEntryHandle)
return NULL; return NULL;
@ -3388,7 +3388,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern,
TRACE("(%s, %p, %p)\n", debugstr_w(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize); TRACE("(%s, %p, %p)\n", debugstr_w(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize);
pEntryHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEntryHandle)); pEntryHandle = heap_alloc(sizeof(*pEntryHandle));
if (!pEntryHandle) if (!pEntryHandle)
return NULL; return NULL;

View File

@ -172,7 +172,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
len = strlenW(lpszServerName); len = strlenW(lpszServerName);
sz = WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, NULL, 0, NULL, NULL ); sz = WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, NULL, 0, NULL, NULL );
if (!(name = HeapAlloc( GetProcessHeap(), 0, sz + 1 ))) return FALSE; if (!(name = heap_alloc(sz + 1))) return FALSE;
WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, name, sz, NULL, NULL ); WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, name, sz, NULL, NULL );
name[sz] = 0; name[sz] = 0;
@ -320,7 +320,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
case INTERNET_STATUS_NAME_RESOLVED: case INTERNET_STATUS_NAME_RESOLVED:
case INTERNET_STATUS_CONNECTING_TO_SERVER: case INTERNET_STATUS_CONNECTING_TO_SERVER:
case INTERNET_STATUS_CONNECTED_TO_SERVER: case INTERNET_STATUS_CONNECTED_TO_SERVER:
lpvNewInfo = HeapAlloc(GetProcessHeap(), 0, strlen(lpvStatusInfo) + 1); lpvNewInfo = heap_alloc(strlen(lpvStatusInfo) + 1);
if (lpvNewInfo) strcpy(lpvNewInfo, lpvStatusInfo); if (lpvNewInfo) strcpy(lpvNewInfo, lpvStatusInfo);
break; break;
case INTERNET_STATUS_RESOLVING_NAME: case INTERNET_STATUS_RESOLVING_NAME:
@ -379,7 +379,7 @@ void SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext,
if (lpvStatusInfo) if (lpvStatusInfo)
{ {
lpvStatusInfo_copy = HeapAlloc(GetProcessHeap(), 0, dwStatusInfoLength); lpvStatusInfo_copy = heap_alloc(dwStatusInfoLength);
memcpy(lpvStatusInfo_copy, lpvStatusInfo, dwStatusInfoLength); memcpy(lpvStatusInfo_copy, lpvStatusInfo, dwStatusInfoLength);
} }