Module: wine Branch: master Commit: eaf4492c704da1190b3b3844e7340a275d71acbf URL: http://source.winehq.org/git/wine.git/?a=commit;h=eaf4492c704da1190b3b3844e7...
Author: Huw Davies huw@codeweavers.com Date: Thu Mar 19 12:23:45 2009 +0000
rpcrt4: Dynamically allocate the buffer if the fixed size one isn't large enough. Don't return an inappropriate error if we fail to get the status text, it's only used for diagnostics.
---
dlls/rpcrt4/rpc_transport.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index 7de6230..9e4186c 100644 --- a/dlls/rpcrt4/rpc_transport.c +++ b/dlls/rpcrt4/rpc_transport.c @@ -1597,8 +1597,8 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor) DWORD status_code; DWORD size; DWORD index; - WCHAR status_text[32]; - + WCHAR buf[32]; + WCHAR *status_text = buf; TRACE("\n");
index = 0; @@ -1609,11 +1609,17 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor) if (status_code < 400) return RPC_S_OK; index = 0; - size = sizeof(status_text); + size = sizeof(buf); ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index); - if (!ret) - return GetLastError(); - ERR("server returned: %d %s\n", status_code, debugstr_w(status_text)); + if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + status_text = HeapAlloc(GetProcessHeap(), 0, size); + ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index); + } + + ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : "<status text unavailable>"); + if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text); + if (status_code == HTTP_STATUS_DENIED) return ERROR_ACCESS_DENIED; return RPC_S_SERVER_UNAVAILABLE;