r7025@Kushana: nickm | 2006-08-04 12:03:22 -0700

Finish (I hope) windows mmap impl.


svn:r6981
This commit is contained in:
Nick Mathewson 2006-08-04 19:03:40 +00:00
parent bf72878cad
commit db72fb9cdc

View File

@ -169,18 +169,20 @@ tor_mmap_file(const char *filename, const char **data, size_t *size)
{ {
win_mmap_t *res = tor_malloc_zero(res); win_mmap_t *res = tor_malloc_zero(res);
res->mmap_handle = res->file_handle = INVALID_HANDLE_VALUE; res->mmap_handle = res->file_handle = INVALID_HANDLE_VALUE;
/* What's this about tags? */
/* Open the file. */ res->file_handle = CreateFileForMapping(filename,
res->file_handle = XXXXX; GENERIC_READ,
0, NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
res->size = GetFileSize(res->file_handle, NULL); res->size = GetFileSize(res->file_handle, NULL);
res->mmap_handle = CreateFileMapping(res->file_handle, res->mmap_handle = CreateFileMapping(res->file_handle,
NULL, NULL,
PAGE_READONLY, PAGE_READONLY,
0, (size >> 32),
size, (size & 0xfffffffful),
tagname); NULL);
if (res->mmap_handle != INVALID_HANDLE_VALUE) if (res->mmap_handle != INVALID_HANDLE_VALUE)
goto err; goto err;
res->data = (char*) MapViewOfFile(res->mmap_handle, res->data = (char*) MapViewOfFile(res->mmap_handle,