[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r6981: Finish (I hope) windows mmap impl. (in tor/trunk: . src/common)



Author: nickm
Date: 2006-08-04 15:03:40 -0400 (Fri, 04 Aug 2006)
New Revision: 6981

Modified:
   tor/trunk/
   tor/trunk/src/common/compat.c
Log:
 r7025@Kushana:  nickm | 2006-08-04 12:03:22 -0700
 Finish (I hope) windows mmap impl.



Property changes on: tor/trunk
___________________________________________________________________
Name: svk:merge
   - 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7012
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
   + 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7025
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950

Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c	2006-08-04 18:32:43 UTC (rev 6980)
+++ tor/trunk/src/common/compat.c	2006-08-04 19:03:40 UTC (rev 6981)
@@ -169,18 +169,20 @@
 {
   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,