Index: runtime/bin/file_win.cc |
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc |
index c9f98b560a1e375feea1684c6ed4bde87550611b..3e326c314561904db52862709dbabc2d8205a6e0 100644 |
--- a/runtime/bin/file_win.cc |
+++ b/runtime/bin/file_win.cc |
@@ -75,8 +75,24 @@ bool File::IsClosed() { |
void* File::Map(MapType type, int64_t position, int64_t length) { |
- UNIMPLEMENTED(); |
- return NULL; |
+ ASSERT(handle_->fd() >= 0); |
+ int flags; |
+ switch (type) { |
+ case kReadOnly: |
+ flags = PAGE_READONLY; |
+ break; |
+ case KReadExecute: |
+ flags = PAGE_EXECUTE_READ: |
+ break; |
+ default: |
+ return NULL; |
+ } |
+ HANDLE mapping = CreateFileMapping(handle_->fd(), NULL, flags, 0, 0, NULL); |
Cutch
2016/10/17 19:28:57
error checking on mapping?
rmacnak
2016/10/18 00:47:34
Done.
|
+ return MapViewOfFile(mapping, |
Cutch
2016/10/17 19:28:57
check the result of MapViewOfFile and report:
OS:
rmacnak
2016/10/18 00:47:34
Done.
|
+ FILE_MAP_READ, |
+ Utils::High32Bits(position), |
+ Utils::Low32Bits(position), |
+ length); |
} |