Hans Leidekker : winhttp: Implement IWinHttpRequest::get_StatusText.

Alexandre Julliard julliard at winehq.org
Thu Jul 21 10:50:50 CDT 2011


Module: wine
Branch: master
Commit: 39468db2d6ca7832290349c8f9e0b7bc9d8ebc14
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=39468db2d6ca7832290349c8f9e0b7bc9d8ebc14

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Jul 21 11:52:00 2011 +0200

winhttp: Implement IWinHttpRequest::get_StatusText.

---

 dlls/winhttp/request.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 97fe255..859bd9d 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -2575,8 +2575,28 @@ static HRESULT WINAPI winhttp_request_get_StatusText(
     IWinHttpRequest *iface,
     BSTR *status )
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    struct winhttp_request *request = impl_from_IWinHttpRequest( iface );
+    DWORD err, len = 0, index = 0;
+
+    TRACE("%p, %p\n", request, status);
+
+    if (request->state < REQUEST_STATE_SENT)
+    {
+        return HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND );
+    }
+    if ((err = request_wait_for_response( request, INFINITE, NULL ))) return HRESULT_FROM_WIN32( err );
+
+    WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_STATUS_TEXT, NULL, NULL, &len, &index );
+    err = GetLastError();
+    if (err != ERROR_INSUFFICIENT_BUFFER) return HRESULT_FROM_WIN32( err );
+    if (!(*status = SysAllocStringLen( NULL, len / sizeof(WCHAR) ))) return E_OUTOFMEMORY;
+    index = 0;
+    if (!WinHttpQueryHeaders( request->hrequest, WINHTTP_QUERY_STATUS_TEXT, NULL, *status, &len, &index ))
+    {
+        SysFreeString( *status );
+        return HRESULT_FROM_WIN32( GetLastError() );
+    }
+    return S_OK;
 }
 
 static HRESULT WINAPI winhttp_request_get_ResponseText(




More information about the wine-cvs mailing list