Hans Leidekker : winhttp: Implement WinHttpSetStatusCallback. Start sending notifications.

Alexandre Julliard julliard at winehq.org
Tue Aug 19 08:46:58 CDT 2008


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

Author: Hans Leidekker <hans at meelstraat.net>
Date:   Fri Aug 15 14:43:07 2008 +0200

winhttp: Implement WinHttpSetStatusCallback. Start sending notifications.

---

 dlls/winhttp/handle.c          |    2 ++
 dlls/winhttp/session.c         |   33 +++++++++++++++++++++++++++++++++
 dlls/winhttp/winhttp.spec      |    2 +-
 dlls/winhttp/winhttp_private.h |    2 ++
 4 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/dlls/winhttp/handle.c b/dlls/winhttp/handle.c
index 8886788..607bfcd 100644
--- a/dlls/winhttp/handle.c
+++ b/dlls/winhttp/handle.c
@@ -77,6 +77,8 @@ void release_object( object_header_t *hdr )
     TRACE("object %p refcount = %d\n", hdr, refs);
     if (!refs)
     {
+        send_callback( hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, &hdr->handle, sizeof(HINTERNET) );
+
         TRACE("destroying object %p\n", hdr);
         if (hdr->type != WINHTTP_HANDLE_TYPE_SESSION) list_remove( &hdr->entry );
         hdr->vtbl->destroy( hdr );
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 9a668b3..26f229e 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -37,6 +37,11 @@ static void set_last_error( DWORD error )
     SetLastError( error );
 }
 
+void send_callback( object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen )
+{
+    FIXME("%p, %u, %p, %u\n", hdr, status, info, buflen);
+}
+
 /***********************************************************************
  *          WinHttpCheckPlatform (winhttp.@)
  */
@@ -175,6 +180,8 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
     if (!(hconnect = alloc_handle( &connect->hdr ))) goto end;
     connect->hdr.handle = hconnect;
 
+    send_callback( &session->hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, &hconnect, sizeof(hconnect) );
+
 end:
     release_object( &connect->hdr );
 
@@ -262,6 +269,8 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
     if (!(hrequest = alloc_handle( &request->hdr ))) goto end;
     request->hdr.handle = hrequest;
 
+    send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, &hrequest, sizeof(hrequest) );
+
 end:
     release_object( &request->hdr );
 
@@ -287,3 +296,27 @@ BOOL WINAPI WinHttpCloseHandle( HINTERNET handle )
     free_handle( handle );
     return TRUE;
 }
+
+/***********************************************************************
+ *          WinHttpSetStatusCallback (winhttp.@)
+ */
+WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHTTP_STATUS_CALLBACK callback,
+                                                         DWORD flags, DWORD_PTR reserved )
+{
+    object_header_t *hdr;
+    WINHTTP_STATUS_CALLBACK ret;
+
+    TRACE("%p, %p, 0x%08x, 0x%lx\n", handle, callback, flags, reserved);
+
+    if (!(hdr = grab_object( handle )))
+    {
+        set_last_error( ERROR_INVALID_HANDLE );
+        return WINHTTP_INVALID_STATUS_CALLBACK;
+    }
+    ret = hdr->callback;
+    hdr->callback = callback;
+    hdr->notify_mask = flags;
+
+    release_object( hdr );
+    return ret;
+}
diff --git a/dlls/winhttp/winhttp.spec b/dlls/winhttp/winhttp.spec
index ce9407e..dc13d5d 100644
--- a/dlls/winhttp/winhttp.spec
+++ b/dlls/winhttp/winhttp.spec
@@ -24,7 +24,7 @@
 @ stub WinHttpSetCredentials
 @ stub WinHttpSetDefaultProxyConfiguration
 @ stdcall WinHttpSetOption(ptr long ptr long)
-@ stub WinHttpSetStatusCallback
+@ stdcall WinHttpSetStatusCallback(ptr ptr long ptr)
 @ stub WinHttpSetTimeouts
 @ stdcall WinHttpTimeFromSystemTime(ptr ptr)
 @ stdcall WinHttpTimeToSystemTime(wstr ptr)
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 0f87466..c13a63a 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -116,6 +116,8 @@ void release_object( object_header_t * );
 HINTERNET alloc_handle( object_header_t * );
 BOOL free_handle( HINTERNET );
 
+void send_callback( object_header_t *, DWORD, LPVOID, DWORD );
+
 static inline void *heap_alloc( SIZE_T size )
 {
     return HeapAlloc( GetProcessHeap(), 0, size );




More information about the wine-cvs mailing list