Module: wine Branch: master Commit: 4e3eabd6fa261976296e74d3cb0c3c09e87842e7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4e3eabd6fa261976296e74d3cb...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Nov 30 00:14:41 2009 +0100
wininet: Don't use INTERNET_SetLastError in HttpSendRequestW.
---
dlls/wininet/http.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index a250cbf..e4b6f1c 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -3405,7 +3405,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, http_request_t *lpwhr; http_session_t *lpwhs = NULL; appinfo_t *hIC = NULL; - BOOL r; + DWORD res = ERROR_SUCCESS;
TRACE("%p, %s, %i, %p, %i)\n", hHttpRequest, debugstr_wn(lpszHeaders, dwHeaderLength), dwHeaderLength, lpOptional, dwOptionalLength); @@ -3413,24 +3413,21 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, lpwhr = (http_request_t*) WININET_GetObject( hHttpRequest ); if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) { - INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - r = FALSE; + res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; }
lpwhs = lpwhr->lpHttpSession; if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) { - INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - r = FALSE; + res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; }
hIC = lpwhs->lpAppInfo; if (NULL == hIC || hIC->hdr.htype != WH_HINIT) { - INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - r = FALSE; + res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; }
@@ -3464,19 +3461,23 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, /* * This is from windows. */ - INTERNET_SetLastError(ERROR_IO_PENDING); - r = FALSE; + res = ERROR_IO_PENDING; } else { - r = HTTP_HttpSendRequestW(lpwhr, lpszHeaders, + BOOL r = HTTP_HttpSendRequestW(lpwhr, lpszHeaders, dwHeaderLength, lpOptional, dwOptionalLength, dwOptionalLength, TRUE); + if(!r) + res = INTERNET_GetLastError(); } lend: if( lpwhr ) WININET_Release( &lpwhr->hdr ); - return r; + + if(res != ERROR_SUCCESS) + SetLastError(res); + return res == ERROR_SUCCESS; }
/***********************************************************************