Commit 47f490e1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Added support for locking HTTP request files.

parent 817d6625
......@@ -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 = {
......
......@@ -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);
}
......
......@@ -250,6 +250,7 @@ typedef enum
typedef struct
{
LONG ref;
HANDLE file_handle;
WCHAR *file_name;
BOOL is_committed;
} req_file_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment