winhttp: Implement WinHttpSetStatusCallback. Start sending notifications.
This commit is contained in:
parent
ce00aa019f
commit
a3d9df7d4d
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue