aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-08-04 19:03:40 +0000
committerNick Mathewson <nickm@torproject.org>2006-08-04 19:03:40 +0000
commitdb72fb9cdc991de0b102af8276bb0199bd254006 (patch)
treeea1eaa4d37ce054d4b698d6eed3924674cd9dc88 /src/common/compat.c
parentbf72878cada8e60d9ceaffa6a9e7bcaf08ffe33c (diff)
downloadtor-db72fb9cdc991de0b102af8276bb0199bd254006.tar
tor-db72fb9cdc991de0b102af8276bb0199bd254006.tar.gz
r7025@Kushana: nickm | 2006-08-04 12:03:22 -0700
Finish (I hope) windows mmap impl. svn:r6981
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 944640e2a..aeff6b4a7 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -169,18 +169,20 @@ tor_mmap_file(const char *filename, const char **data, size_t *size)
{
win_mmap_t *res = tor_malloc_zero(res);
res->mmap_handle = res->file_handle = INVALID_HANDLE_VALUE;
- /* What's this about tags? */
- /* Open the file. */
- res->file_handle = XXXXX;
+ res->file_handle = CreateFileForMapping(filename,
+ GENERIC_READ,
+ 0, NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, 0);
res->size = GetFileSize(res->file_handle, NULL);
res->mmap_handle = CreateFileMapping(res->file_handle,
NULL,
PAGE_READONLY,
- 0,
- size,
- tagname);
+ (size >> 32),
+ (size & 0xfffffffful),
+ NULL);
if (res->mmap_handle != INVALID_HANDLE_VALUE)
goto err;
res->data = (char*) MapViewOfFile(res->mmap_handle,