urlmon: Moved HttpProtocol::[Lock|Unlock]Request implementation to generic Protocol object.

This commit is contained in:
Jacek Caban 2009-03-02 03:19:44 +01:00 committed by Alexandre Julliard
parent 4ae60c6f00
commit 7c77c57ab8
4 changed files with 50 additions and 12 deletions

View File

@ -17,6 +17,7 @@ C_SRCS = \
http.c \
internet.c \
mk.c \
protocol.c \
regsvr.c \
sec_mgr.c \
session.c \

View File

@ -827,10 +827,7 @@ static HRESULT WINAPI HttpProtocol_LockRequest(IInternetProtocol *iface, DWORD d
TRACE("(%p)->(%08x)\n", This, dwOptions);
if (!InternetLockRequestFile(This->base.request, &This->base.lock))
WARN("InternetLockRequest failed: %d\n", GetLastError());
return S_OK;
return protocol_lock_request(&This->base);
}
static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocol *iface)
@ -839,14 +836,7 @@ static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocol *iface)
TRACE("(%p)\n", This);
if (This->base.lock)
{
if (!InternetUnlockRequestFile(This->base.lock))
WARN("InternetUnlockRequest failed: %d\n", GetLastError());
This->base.lock = 0;
}
return S_OK;
return protocol_unlock_request(&This->base);
}
#undef PROTOCOL_THIS

44
dlls/urlmon/protocol.c Normal file
View File

@ -0,0 +1,44 @@
/*
* Copyright 2007 Misha Koshelev
* Copyright 2009 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "urlmon_main.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
HRESULT protocol_lock_request(Protocol *protocol)
{
if (!InternetLockRequestFile(protocol->request, &protocol->lock))
WARN("InternetLockRequest failed: %d\n", GetLastError());
return S_OK;
}
HRESULT protocol_unlock_request(Protocol *protocol)
{
if(!protocol->lock)
return S_OK;
if(!InternetUnlockRequestFile(protocol->lock))
WARN("InternetUnlockRequest failed: %d\n", GetLastError());
protocol->lock = 0;
return S_OK;
}

View File

@ -98,6 +98,9 @@ typedef struct {
LONG priority;
} Protocol;
HRESULT protocol_lock_request(Protocol*);
HRESULT protocol_unlock_request(Protocol*);
static inline void *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);