wininet: Added support for locking HTTP request files.

This commit is contained in:
Jacek Caban 2013-10-04 16:53:22 +02:00 committed by Alexandre Julliard
parent 817d6625a8
commit 47f490e1f6
3 changed files with 20 additions and 2 deletions

View File

@ -3255,8 +3255,16 @@ done:
static DWORD HTTPREQ_LockRequestFile(object_header_t *hdr, req_file_t **ret)
{
http_request_t *req = (http_request_t*)hdr;
FIXME("(%p)\n", req);
return ERROR_NOT_SUPPORTED;
TRACE("(%p)\n", req);
if(!req->req_file) {
WARN("No cache file name available\n");
return ERROR_FILE_NOT_FOUND;
}
*ret = req_file_addref(req->req_file);
return ERROR_SUCCESS;
}
static const object_vtbl_t HTTPREQVtbl = {

View File

@ -3917,6 +3917,13 @@ DWORD create_req_file(const WCHAR *file_name, req_file_t **ret)
return ERROR_NOT_ENOUGH_MEMORY;
}
req_file->file_handle = CreateFileW(req_file->file_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(req_file->file_handle == INVALID_HANDLE_VALUE) {
req_file_release(req_file);
return GetLastError();
}
*ret = req_file;
return ERROR_SUCCESS;
}
@ -3928,6 +3935,8 @@ void req_file_release(req_file_t *req_file)
if(!req_file->is_committed)
DeleteFileW(req_file->file_name);
if(req_file->file_handle && req_file->file_handle != INVALID_HANDLE_VALUE)
CloseHandle(req_file->file_handle);
heap_free(req_file->file_name);
heap_free(req_file);
}

View File

@ -250,6 +250,7 @@ typedef enum
typedef struct
{
LONG ref;
HANDLE file_handle;
WCHAR *file_name;
BOOL is_committed;
} req_file_t;