diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index 004933ff81d..af1d19d2123 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -225,7 +225,7 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto FD_ZERO( &set ); FD_SET( conn->socket, &set ); if ((res = select( conn->socket + 1, NULL, &set, NULL, &timeval )) > 0) ret = TRUE; - else if (!res) set_last_error( ERROR_WINHTTP_TIMEOUT ); + else if (!res) SetLastError( ERROR_WINHTTP_TIMEOUT ); } } @@ -233,7 +233,7 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto if (!ret) { - WARN("unable to connect to host (%u)\n", get_last_error()); + WARN("unable to connect to host (%u)\n", GetLastError()); closesocket( conn->socket ); heap_free( conn ); return NULL; @@ -378,7 +378,7 @@ BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD securi heap_free(conn->ssl_buf); conn->ssl_buf = NULL; DeleteSecurityContext(&ctx); - set_last_error(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR); + SetLastError(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR); return FALSE; } @@ -690,7 +690,7 @@ BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_stora if (ret) { - set_last_error( ret ); + SetLastError( ret ); return FALSE; } return TRUE; diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 0f37f38422c..54173f1ff48 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -420,7 +420,7 @@ static BOOL process_header( struct request *request, const WCHAR *field, const W } else if (!(flags & WINHTTP_ADDREQ_FLAG_ADD)) { - set_last_error( ERROR_WINHTTP_HEADER_NOT_FOUND ); + SetLastError( ERROR_WINHTTP_HEADER_NOT_FOUND ); return FALSE; } @@ -520,25 +520,25 @@ BOOL WINAPI WinHttpAddRequestHeaders( HINTERNET hrequest, LPCWSTR headers, DWORD if (!headers || !len) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } ret = add_request_headers( request, headers, len, flags ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -652,7 +652,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na for (len = 0; *p; p++) if (*p != '\r') len++; if (!buffer || len * sizeof(WCHAR) > *buflen) - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); else { for (p = headers, q = buffer; *p; p++, q++) @@ -686,7 +686,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na if (!buffer || len + sizeof(WCHAR) > *buflen) { len += sizeof(WCHAR); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); } else { @@ -703,7 +703,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na if (!buffer || len + sizeof(WCHAR) > *buflen) { len += sizeof(WCHAR); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); } else { @@ -719,7 +719,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na if (!buffer || len + sizeof(WCHAR) > *buflen) { len += sizeof(WCHAR); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); } else { @@ -747,14 +747,14 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na } if (!header || (request_only && !header->is_request)) { - set_last_error( ERROR_WINHTTP_HEADER_NOT_FOUND ); + SetLastError( ERROR_WINHTTP_HEADER_NOT_FOUND ); return FALSE; } if (level & WINHTTP_QUERY_FLAG_NUMBER) { if (!buffer || sizeof(int) > *buflen) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); } else { @@ -770,7 +770,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na SYSTEMTIME *st = buffer; if (!buffer || sizeof(SYSTEMTIME) > *buflen) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); } else if ((ret = WinHttpTimeToSystemTime( header->value, st ))) { @@ -786,7 +786,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na if (!buffer || len + sizeof(WCHAR) > *buflen) { len += sizeof(WCHAR); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); } else { @@ -812,20 +812,20 @@ BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name, if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } ret = query_headers( request, level, name, buffer, buflen, index ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -882,7 +882,7 @@ static BOOL query_auth_schemes( struct request *request, DWORD level, DWORD *sup size = 0; query_headers( request, level, NULL, NULL, &size, &index ); - if (get_last_error() != ERROR_INSUFFICIENT_BUFFER) break; + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) break; if (!(buffer = heap_alloc( size ))) return FALSE; if (!query_headers( request, level, NULL, buffer, &size, &index )) @@ -920,19 +920,19 @@ BOOL WINAPI WinHttpQueryAuthSchemes( HINTERNET hrequest, LPDWORD supported, LPDW if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } if (!supported || !first || !target) { release_object( &request->hdr ); - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -947,10 +947,10 @@ BOOL WINAPI WinHttpQueryAuthSchemes( HINTERNET hrequest, LPDWORD supported, LPDW *target = WINHTTP_AUTH_TARGET_PROXY; ret = TRUE; } - else set_last_error( ERROR_INVALID_OPERATION ); + else SetLastError( ERROR_INVALID_OPERATION ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2255,7 +2255,7 @@ end: { WINHTTP_ASYNC_RESULT result; result.dwResult = API_SEND_REQUEST; - result.dwError = get_last_error(); + result.dwError = GetLastError(); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); } } @@ -2283,13 +2283,13 @@ BOOL WINAPI WinHttpSendRequest( HINTERNET hrequest, LPCWSTR headers, DWORD heade if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } @@ -2316,7 +2316,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNET hrequest, LPCWSTR headers, DWORD heade ret = send_request( request, headers, headers_len, optional, optional_len, total_len, context, FALSE ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2327,7 +2327,7 @@ static BOOL set_credentials( struct request *request, DWORD target, DWORD scheme if (scheme == SCHEME_INVALID || ((scheme == SCHEME_BASIC || scheme == SCHEME_DIGEST) && (!username || !password))) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } switch (target) @@ -2374,20 +2374,20 @@ BOOL WINAPI WinHttpSetCredentials( HINTERNET hrequest, DWORD target, DWORD schem if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } ret = set_credentials( request, target, scheme, username, password ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2612,7 +2612,7 @@ static WCHAR *get_redirect_url( struct request *request, DWORD *len ) WCHAR *ret; query_headers( request, WINHTTP_QUERY_LOCATION, NULL, NULL, &size, NULL ); - if (get_last_error() != ERROR_INSUFFICIENT_BUFFER) return FALSE; + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FALSE; if (!(ret = heap_alloc( size ))) return NULL; *len = size / sizeof(WCHAR) - 1; if (query_headers( request, WINHTTP_QUERY_LOCATION, NULL, ret, &size, NULL )) return ret; @@ -2741,7 +2741,7 @@ static BOOL receive_response( struct request *request, BOOL async ) { if (!(ret = read_reply( request ))) { - set_last_error( ERROR_WINHTTP_INVALID_SERVER_RESPONSE ); + SetLastError( ERROR_WINHTTP_INVALID_SERVER_RESPONSE ); break; } size = sizeof(DWORD); @@ -2784,7 +2784,7 @@ static BOOL receive_response( struct request *request, BOOL async ) { WINHTTP_ASYNC_RESULT result; result.dwResult = API_RECEIVE_RESPONSE; - result.dwError = get_last_error(); + result.dwError = GetLastError(); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); } } @@ -2809,13 +2809,13 @@ BOOL WINAPI WinHttpReceiveResponse( HINTERNET hrequest, LPVOID reserved ) if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } @@ -2834,7 +2834,7 @@ BOOL WINAPI WinHttpReceiveResponse( HINTERNET hrequest, LPVOID reserved ) ret = receive_response( request, FALSE ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2880,13 +2880,13 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } @@ -2906,7 +2906,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) ret = query_data_available( request, available, FALSE ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2928,13 +2928,13 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, LPVOID buffer, DWORD to_read, L if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } @@ -2956,7 +2956,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, LPVOID buffer, DWORD to_read, L ret = read_data( request, buffer, to_read, read, FALSE ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2974,7 +2974,7 @@ static BOOL write_data( struct request *request, const void *buffer, DWORD to_wr { WINHTTP_ASYNC_RESULT result; result.dwResult = API_WRITE_DATA; - result.dwError = get_last_error(); + result.dwError = GetLastError(); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); } } @@ -3000,13 +3000,13 @@ BOOL WINAPI WinHttpWriteData( HINTERNET hrequest, LPCVOID buffer, DWORD to_write if (!(request = (struct request *)grab_object( hrequest ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) { release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } @@ -3028,7 +3028,7 @@ BOOL WINAPI WinHttpWriteData( HINTERNET hrequest, LPCVOID buffer, DWORD to_write ret = write_data( request, buffer, to_write, written, FALSE ); release_object( &request->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -3429,7 +3429,7 @@ static HRESULT WINAPI winhttp_request_SetCredentials( } if (!WinHttpSetCredentials( request->hrequest, target, scheme, username, password, NULL )) { - err = get_last_error(); + err = GetLastError(); } done: LeaveCriticalSection( &request->cs ); @@ -3515,7 +3515,7 @@ static HRESULT WINAPI winhttp_request_Open( uc.dwHostNameLength = ~0u; uc.dwUrlPathLength = ~0u; uc.dwExtraInfoLength = ~0u; - if (!WinHttpCrackUrl( url, 0, 0, &uc )) return HRESULT_FROM_WIN32( get_last_error() ); + if (!WinHttpCrackUrl( url, 0, 0, &uc )) return HRESULT_FROM_WIN32( GetLastError() ); EnterCriticalSection( &request->cs ); if (request->state < REQUEST_STATE_INITIALIZED) initialize_request( request ); @@ -3538,20 +3538,20 @@ static HRESULT WINAPI winhttp_request_Open( if (!(request->hsession = WinHttpOpen( user_agentW, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, NULL, NULL, WINHTTP_FLAG_ASYNC ))) { - err = get_last_error(); + err = GetLastError(); goto error; } if (!(request->hconnect = WinHttpConnect( request->hsession, hostname, uc.nPort, 0 ))) { WinHttpCloseHandle( request->hsession ); request->hsession = NULL; - err = get_last_error(); + err = GetLastError(); goto error; } } else if (!(request->hconnect = WinHttpConnect( request->hsession, hostname, uc.nPort, 0 ))) { - err = get_last_error(); + err = GetLastError(); goto error; } @@ -3562,7 +3562,7 @@ static HRESULT WINAPI winhttp_request_Open( } if (!(request->hrequest = WinHttpOpenRequest( request->hconnect, method, path, NULL, NULL, acceptW, flags ))) { - err = get_last_error(); + err = GetLastError(); goto error; } WinHttpSetOption( request->hrequest, WINHTTP_OPTION_CONTEXT_VALUE, &request, sizeof(request) ); @@ -3621,7 +3621,7 @@ static HRESULT WINAPI winhttp_request_SetRequestHeader( if (!WinHttpAddRequestHeaders( request->hrequest, str, len, WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE )) { - err = get_last_error(); + err = GetLastError(); } heap_free( str ); @@ -3654,7 +3654,7 @@ static HRESULT WINAPI winhttp_request_GetResponseHeader( size = 0; if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_CUSTOM, header, NULL, &size, NULL )) { - err = get_last_error(); + err = GetLastError(); if (err != ERROR_INSUFFICIENT_BUFFER) goto done; } if (!(*value = SysAllocStringLen( NULL, size / sizeof(WCHAR) ))) @@ -3665,7 +3665,7 @@ static HRESULT WINAPI winhttp_request_GetResponseHeader( err = ERROR_SUCCESS; if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_CUSTOM, header, *value, &size, NULL )) { - err = get_last_error(); + err = GetLastError(); SysFreeString( *value ); } done: @@ -3693,7 +3693,7 @@ static HRESULT WINAPI winhttp_request_GetAllResponseHeaders( size = 0; if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_RAW_HEADERS_CRLF, NULL, NULL, &size, NULL )) { - err = get_last_error(); + err = GetLastError(); if (err != ERROR_INSUFFICIENT_BUFFER) goto done; } if (!(*headers = SysAllocStringLen( NULL, size / sizeof(WCHAR) ))) @@ -3704,7 +3704,7 @@ static HRESULT WINAPI winhttp_request_GetAllResponseHeaders( err = ERROR_SUCCESS; if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_RAW_HEADERS_CRLF, NULL, *headers, &size, NULL )) { - err = get_last_error(); + err = GetLastError(); SysFreeString( *headers ); } done: @@ -3755,7 +3755,7 @@ static DWORD wait_for_completion( struct winhttp_request *request ) request->error = ERROR_CANCELLED; break; default: - request->error = get_last_error(); + request->error = GetLastError(); break; } return request->error; @@ -3768,7 +3768,7 @@ static HRESULT request_receive( struct winhttp_request *request ) wait_set_status_callback( request, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE ); if (!WinHttpReceiveResponse( request->hrequest, NULL )) { - return HRESULT_FROM_WIN32( get_last_error() ); + return HRESULT_FROM_WIN32( GetLastError() ); } if ((err = wait_for_completion( request ))) return HRESULT_FROM_WIN32( err ); if (!strcmpW( request->verb, headW )) @@ -3784,7 +3784,7 @@ static HRESULT request_receive( struct winhttp_request *request ) wait_set_status_callback( request, WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE ); if (!WinHttpQueryDataAvailable( request->hrequest, &request->bytes_available )) { - err = get_last_error(); + err = GetLastError(); goto error; } if ((err = wait_for_completion( request ))) goto error; @@ -3805,7 +3805,7 @@ static HRESULT request_receive( struct winhttp_request *request ) if (!WinHttpReadData( request->hrequest, request->buffer + request->offset, request->bytes_available, &request->bytes_read )) { - err = get_last_error(); + err = GetLastError(); goto error; } if ((err = wait_for_completion( request ))) goto error; @@ -3824,19 +3824,19 @@ error: static DWORD request_set_parameters( struct winhttp_request *request ) { if (!WinHttpSetOption( request->hrequest, WINHTTP_OPTION_PROXY, &request->proxy, - sizeof(request->proxy) )) return get_last_error(); + sizeof(request->proxy) )) return GetLastError(); if (!WinHttpSetOption( request->hrequest, WINHTTP_OPTION_AUTOLOGON_POLICY, &request->logon_policy, - sizeof(request->logon_policy) )) return get_last_error(); + sizeof(request->logon_policy) )) return GetLastError(); if (!WinHttpSetOption( request->hrequest, WINHTTP_OPTION_DISABLE_FEATURE, &request->disable_feature, - sizeof(request->disable_feature) )) return get_last_error(); + sizeof(request->disable_feature) )) return GetLastError(); if (!WinHttpSetTimeouts( request->hrequest, request->resolve_timeout, request->connect_timeout, request->send_timeout, - request->receive_timeout )) return get_last_error(); + request->receive_timeout )) return GetLastError(); return ERROR_SUCCESS; } @@ -3901,7 +3901,7 @@ static HRESULT request_send( struct winhttp_request *request ) wait_set_status_callback( request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT ); if (!WinHttpSendRequest( request->hrequest, NULL, 0, ptr, size, size, 0 )) { - err = get_last_error(); + err = GetLastError(); goto error; } if ((err = wait_for_completion( request ))) goto error; @@ -3955,7 +3955,7 @@ static DWORD request_wait( struct winhttp_request *request, DWORD timeout ) break; case WAIT_FAILED: default: - ret = get_last_error(); + ret = GetLastError(); break; } EnterCriticalSection( &request->cs ); @@ -3991,7 +3991,7 @@ static HRESULT WINAPI winhttp_request_Send( if (!(request->thread = CreateThread( NULL, 0, send_and_receive_proc, request, 0, NULL ))) { LeaveCriticalSection( &request->cs ); - return HRESULT_FROM_WIN32( get_last_error() ); + return HRESULT_FROM_WIN32( GetLastError() ); } request->wait = CreateEventW( NULL, FALSE, FALSE, NULL ); request->cancel = CreateEventW( NULL, FALSE, FALSE, NULL ); @@ -4023,7 +4023,7 @@ static HRESULT WINAPI winhttp_request_get_Status( flags = WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER; if (!WinHttpQueryHeaders( request->hrequest, flags, NULL, &status_code, &len, &index )) { - err = get_last_error(); + err = GetLastError(); goto done; } *status = status_code; @@ -4052,7 +4052,7 @@ static HRESULT WINAPI winhttp_request_get_StatusText( } if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_STATUS_TEXT, NULL, NULL, &len, &index )) { - err = get_last_error(); + err = GetLastError(); if (err != ERROR_INSUFFICIENT_BUFFER) goto done; } if (!(*status = SysAllocStringLen( NULL, len / sizeof(WCHAR) ))) @@ -4064,7 +4064,7 @@ static HRESULT WINAPI winhttp_request_get_StatusText( err = ERROR_SUCCESS; if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_STATUS_TEXT, NULL, *status, &len, &index )) { - err = get_last_error(); + err = GetLastError(); SysFreeString( *status ); } done: @@ -4081,12 +4081,12 @@ static DWORD request_get_codepage( struct winhttp_request *request, UINT *codepa *codepage = CP_ACP; if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_CONTENT_TYPE, NULL, NULL, &size, NULL ) && - get_last_error() == ERROR_INSUFFICIENT_BUFFER) + GetLastError() == ERROR_INSUFFICIENT_BUFFER) { if (!(buffer = heap_alloc( size ))) return ERROR_OUTOFMEMORY; if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_CONTENT_TYPE, NULL, buffer, &size, NULL )) { - return get_last_error(); + return GetLastError(); } if ((p = strstrW( buffer, charsetW ))) { diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 8b3f9f51b2b..2051d4282bb 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -52,18 +52,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(winhttp); #define DEFAULT_RECEIVE_TIMEOUT 30000 #define DEFAULT_RECEIVE_RESPONSE_TIMEOUT ~0u -void set_last_error( DWORD error ) -{ - /* FIXME */ - SetLastError( error ); -} - -DWORD get_last_error( void ) -{ - /* FIXME */ - return GetLastError(); -} - void send_callback( struct object_header *hdr, DWORD status, void *info, DWORD buflen ) { if (hdr->callback && (hdr->notify_mask & status)) @@ -117,7 +105,7 @@ static BOOL session_query_option( struct object_header *hdr, DWORD option, void if (!buffer || *buflen < sizeof(DWORD)) { *buflen = sizeof(DWORD); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -152,7 +140,7 @@ static BOOL session_query_option( struct object_header *hdr, DWORD option, void default: FIXME("unimplemented option %u\n", option); - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } } @@ -176,7 +164,7 @@ static BOOL session_set_option( struct object_header *hdr, DWORD option, void *b if (buflen != sizeof(policy)) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -189,7 +177,7 @@ static BOOL session_set_option( struct object_header *hdr, DWORD option, void *b { if (buflen != sizeof(session->secure_protocols)) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } EnterCriticalSection( &session->cs ); @@ -199,7 +187,7 @@ static BOOL session_set_option( struct object_header *hdr, DWORD option, void *b return TRUE; } case WINHTTP_OPTION_DISABLE_FEATURE: - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; case WINHTTP_OPTION_RESOLVE_TIMEOUT: @@ -241,7 +229,7 @@ static BOOL session_set_option( struct object_header *hdr, DWORD option, void *b default: FIXME("unimplemented option %u\n", option); - set_last_error( ERROR_WINHTTP_INVALID_OPTION ); + SetLastError( ERROR_WINHTTP_INVALID_OPTION ); return FALSE; } } @@ -313,7 +301,7 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST end: release_object( &session->hdr ); TRACE("returning %p\n", handle); - if (handle) set_last_error( ERROR_SUCCESS ); + if (handle) SetLastError( ERROR_SUCCESS ); return handle; } @@ -346,7 +334,7 @@ static BOOL connect_query_option( struct object_header *hdr, DWORD option, void if (!buffer || *buflen < sizeof(HINTERNET)) { *buflen = sizeof(HINTERNET); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -381,7 +369,7 @@ static BOOL connect_query_option( struct object_header *hdr, DWORD option, void default: FIXME("unimplemented option %u\n", option); - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } } @@ -553,18 +541,18 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO if (!server) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return NULL; } if (!(session = (struct session *)grab_object( hsession ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return NULL; } if (session->hdr.type != WINHTTP_HANDLE_TYPE_SESSION) { release_object( &session->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return NULL; } if (!(connect = heap_alloc_zero( sizeof(struct connect) ))) @@ -599,7 +587,7 @@ end: release_object( &connect->hdr ); release_object( &session->hdr ); TRACE("returning %p\n", hconnect); - if (hconnect) set_last_error( ERROR_SUCCESS ); + if (hconnect) SetLastError( ERROR_SUCCESS ); return hconnect; } @@ -718,7 +706,7 @@ static BOOL request_query_option( struct object_header *hdr, DWORD option, void if (!buffer || *buflen < sizeof(flags)) { *buflen = sizeof(flags); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -746,7 +734,7 @@ static BOOL request_query_option( struct object_header *hdr, DWORD option, void if (!buffer || *buflen < sizeof(cert)) { *buflen = sizeof(cert); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -766,7 +754,7 @@ static BOOL request_query_option( struct object_header *hdr, DWORD option, void if (!buffer || *buflen < sizeof(*ci)) { *buflen = sizeof(*ci); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } if (!cert) return FALSE; @@ -792,7 +780,7 @@ static BOOL request_query_option( struct object_header *hdr, DWORD option, void if (!buffer || *buflen < sizeof(DWORD)) { *buflen = sizeof(DWORD); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -810,12 +798,12 @@ static BOOL request_query_option( struct object_header *hdr, DWORD option, void if (!buffer || *buflen < sizeof(*info)) { *buflen = sizeof(*info); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } if (!request->netconn) { - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_STATE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_STATE ); return FALSE; } if (getsockname( request->netconn->socket, &local, &len )) return FALSE; @@ -867,7 +855,7 @@ static BOOL request_query_option( struct object_header *hdr, DWORD option, void default: FIXME("unimplemented option %u\n", option); - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } } @@ -881,7 +869,7 @@ static WCHAR *buffer_to_str( WCHAR *buffer, DWORD buflen ) ret[buflen] = 0; return ret; } - set_last_error( ERROR_OUTOFMEMORY ); + SetLastError( ERROR_OUTOFMEMORY ); return NULL; } @@ -904,7 +892,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b if (buflen != sizeof(DWORD)) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -919,7 +907,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b if (buflen != sizeof(DWORD)) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -934,7 +922,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b if (buflen != sizeof(DWORD)) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -949,7 +937,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b if (buflen < sizeof(DWORD)) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } flags = *(DWORD *)buffer; @@ -959,7 +947,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE))) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } request->security_flags = flags; @@ -1045,7 +1033,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b default: FIXME("unimplemented option %u\n", option); - set_last_error( ERROR_WINHTTP_INVALID_OPTION ); + SetLastError( ERROR_WINHTTP_INVALID_OPTION ); return FALSE; } } @@ -1125,13 +1113,13 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o if (!(connect = (struct connect *)grab_object( hconnect ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return NULL; } if (connect->hdr.type != WINHTTP_HANDLE_TYPE_CONNECT) { release_object( &connect->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return NULL; } if (!(request = heap_alloc_zero( sizeof(struct request) ))) @@ -1177,7 +1165,7 @@ end: release_object( &request->hdr ); release_object( &connect->hdr ); TRACE("returning %p\n", hrequest); - if (hrequest) set_last_error( ERROR_SUCCESS ); + if (hrequest) SetLastError( ERROR_SUCCESS ); return hrequest; } @@ -1192,12 +1180,12 @@ BOOL WINAPI WinHttpCloseHandle( HINTERNET handle ) if (!(hdr = grab_object( handle ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } release_object( hdr ); free_handle( handle ); - set_last_error( ERROR_SUCCESS ); + SetLastError( ERROR_SUCCESS ); return TRUE; } @@ -1207,7 +1195,7 @@ static BOOL query_option( struct object_header *hdr, DWORD option, void *buffer, if (!buflen) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -1218,7 +1206,7 @@ static BOOL query_option( struct object_header *hdr, DWORD option, void *buffer, if (!buffer || *buflen < sizeof(DWORD_PTR)) { *buflen = sizeof(DWORD_PTR); - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -1231,7 +1219,7 @@ static BOOL query_option( struct object_header *hdr, DWORD option, void *buffer, else { FIXME("unimplemented option %u\n", option); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } break; @@ -1251,14 +1239,14 @@ BOOL WINAPI WinHttpQueryOption( HINTERNET handle, DWORD option, LPVOID buffer, L if (!(hdr = grab_object( handle ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } ret = query_option( hdr, option, buffer, buflen ); release_object( hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -1268,7 +1256,7 @@ static BOOL set_option( struct object_header *hdr, DWORD option, void *buffer, D if (!buffer && buflen) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -1278,7 +1266,7 @@ static BOOL set_option( struct object_header *hdr, DWORD option, void *buffer, D { if (buflen != sizeof(DWORD_PTR)) { - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } @@ -1290,7 +1278,7 @@ static BOOL set_option( struct object_header *hdr, DWORD option, void *buffer, D else { FIXME("unimplemented option %u\n", option); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } break; @@ -1310,14 +1298,14 @@ BOOL WINAPI WinHttpSetOption( HINTERNET handle, DWORD option, LPVOID buffer, DWO if (!(hdr = grab_object( handle ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } ret = set_option( hdr, option, buffer, buflen ); release_object( hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -1421,7 +1409,7 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url ) if (!flags || !url) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } if (get_system_proxy_autoconfig_url( system_url, sizeof(system_url) )) @@ -1430,7 +1418,7 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url ) if (!(urlW = strdupAW( system_url ))) return FALSE; *url = urlW; - set_last_error( ERROR_SUCCESS ); + SetLastError( ERROR_SUCCESS ); return TRUE; } if (flags & WINHTTP_AUTO_DETECT_TYPE_DHCP) @@ -1484,10 +1472,10 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url ) } if (!ret) { - set_last_error( ERROR_WINHTTP_AUTODETECTION_FAILED ); + SetLastError( ERROR_WINHTTP_AUTODETECTION_FAILED ); *url = NULL; } - else set_last_error( ERROR_SUCCESS ); + else SetLastError( ERROR_SUCCESS ); return ret; } @@ -1646,7 +1634,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) info->lpszProxy = NULL; info->lpszProxyBypass = NULL; } - set_last_error( ERROR_SUCCESS ); + SetLastError( ERROR_SUCCESS ); return TRUE; } @@ -1666,7 +1654,7 @@ BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser( WINHTTP_CURRENT_USER_IE_PROXY if (!config) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } memset( config, 0, sizeof(*config) ); @@ -1729,7 +1717,7 @@ done: GlobalFree( config->lpszProxyBypass ); config->lpszProxyBypass = NULL; } - else set_last_error( ERROR_SUCCESS ); + else SetLastError( ERROR_SUCCESS ); return ret; } @@ -1823,7 +1811,7 @@ done: WinHttpCloseHandle( con ); WinHttpCloseHandle( ses ); heap_free( hostname ); - if (!buffer) set_last_error( ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT ); + if (!buffer) SetLastError( ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT ); return buffer; } @@ -1895,13 +1883,13 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO if (!(session = (struct session *)grab_object( hsession ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } if (session->hdr.type != WINHTTP_HANDLE_TYPE_SESSION) { release_object( &session->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } if (!url || !options || !info || @@ -1911,7 +1899,7 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO (options->dwFlags & WINHTTP_AUTOPROXY_CONFIG_URL))) { release_object( &session->hdr ); - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } if (options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT && @@ -1930,7 +1918,7 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO done: GlobalFree( detected_pac_url ); release_object( &session->hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -1948,7 +1936,7 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) if (!info) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } switch (info->dwAccessType) @@ -1958,14 +1946,14 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) case WINHTTP_ACCESS_TYPE_NAMED_PROXY: if (!info->lpszProxy) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } /* Only ASCII characters are allowed */ for (src = info->lpszProxy; *src; src++) if (*src > 0x7f) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } if (info->lpszProxyBypass) @@ -1973,13 +1961,13 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) for (src = info->lpszProxyBypass; *src; src++) if (*src > 0x7f) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } } break; default: - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -2038,7 +2026,7 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) } RegCloseKey( key ); } - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2055,7 +2043,7 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT if (!(hdr = grab_object( handle ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return WINHTTP_INVALID_STATUS_CALLBACK; } ret = hdr->callback; @@ -2063,7 +2051,7 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT hdr->notify_mask = flags; release_object( hdr ); - set_last_error( ERROR_SUCCESS ); + SetLastError( ERROR_SUCCESS ); return ret; } @@ -2079,13 +2067,13 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int if (resolve < -1 || connect < -1 || send < -1 || receive < -1) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } if (!(hdr = grab_object( handle ))) { - set_last_error( ERROR_INVALID_HANDLE ); + SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } @@ -2128,11 +2116,11 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int break; } default: - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); ret = FALSE; } release_object( hdr ); - if (ret) set_last_error( ERROR_SUCCESS ); + if (ret) SetLastError( ERROR_SUCCESS ); return ret; } @@ -2157,7 +2145,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string ) if (!time || !string) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -2170,7 +2158,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string ) time->wMinute, time->wSecond ); - set_last_error( ERROR_SUCCESS ); + SetLastError( ERROR_SUCCESS ); return TRUE; } @@ -2187,7 +2175,7 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time ) if (!string || !time) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -2198,7 +2186,7 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time ) * a SYSTEMTIME structure. */ - set_last_error( ERROR_SUCCESS ); + SetLastError( ERROR_SUCCESS ); while (*s && !isalphaW( *s )) s++; if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE; diff --git a/dlls/winhttp/url.c b/dlls/winhttp/url.c index f66e5105ab6..e6aeac3df2f 100644 --- a/dlls/winhttp/url.c +++ b/dlls/winhttp/url.c @@ -181,7 +181,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN if (!url || !uc || uc->dwStructSize != sizeof(URL_COMPONENTS)) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } if (!len) len = strlenW( url ); @@ -190,7 +190,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN { if ((err = escape_url( url, &len, &url_escaped ))) { - set_last_error( err ); + SetLastError( err ); return FALSE; } url = url_escaped; @@ -199,14 +199,14 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN { if (!(url_decoded = decode_url( url, &len ))) { - set_last_error( ERROR_OUTOFMEMORY ); + SetLastError( ERROR_OUTOFMEMORY ); return FALSE; } url = url_decoded; } if (!(p = strchrW( url, ':' ))) { - set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ); + SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ); return FALSE; } if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme = INTERNET_SCHEME_HTTP; @@ -307,7 +307,7 @@ exit: } heap_free( url_decoded ); heap_free( url_escaped ); - set_last_error( err ); + SetLastError( err ); return !err; } @@ -372,7 +372,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len ) { if (uc->lpszPassword) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } } @@ -412,7 +412,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -421,12 +421,12 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW if (*required < len) { *required = len + 1; - set_last_error( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } if (!url) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } @@ -497,7 +497,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW { if (!escape_string( uc->lpszUrlPath, len, url, &len_escaped )) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } url += len_escaped; @@ -515,7 +515,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW { if (!escape_string( uc->lpszExtraInfo, len, url, &len_escaped )) { - set_last_error( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } url += len_escaped; @@ -527,6 +527,6 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW } } *url = 0; - set_last_error( ERROR_SUCCESS ); + SetLastError( ERROR_SUCCESS ); return TRUE; } diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 99cde44c885..2ee868c657c 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -265,8 +265,6 @@ void release_object( struct object_header * ) DECLSPEC_HIDDEN; HINTERNET alloc_handle( struct object_header * ) DECLSPEC_HIDDEN; BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN; -void set_last_error( DWORD ) DECLSPEC_HIDDEN; -DWORD get_last_error( void ) DECLSPEC_HIDDEN; void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN; void close_connection( struct request * ) DECLSPEC_HIDDEN;