diff options
-rw-r--r-- | include/Handle.h | 2 | ||||
-rw-r--r-- | lib/Handle.cc | 12 | ||||
-rw-r--r-- | lib/Main.cc | 5 |
3 files changed, 17 insertions, 2 deletions
diff --git a/include/Handle.h b/include/Handle.h index 938c594..64e082b 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -41,7 +41,7 @@ class Handle : public Base { virtual void SetZ(int = 9) throw (GeneralException); virtual void Flush(); - void * mmap(off_t = 0, size_t = -1); + void * mmap(off_t = 0, size_t = -1) throw (GeneralException); protected: Handle(int h); int GetHandle() const; diff --git a/lib/Handle.cc b/lib/Handle.cc index 2006b19..4b2b4f1 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -248,6 +248,13 @@ void Handle::close() throw (GeneralException) { } } } + +#ifdef _WIN32 + if (hFile) { + CloseHandle(hFile); + hFile = 0; + } +#endif h = -1; closed = 1; @@ -514,7 +521,10 @@ void Handle::Flush() { } } -void * Handle::mmap(off_t offset, size_t length) { +void * Handle::mmap(off_t offset, size_t length) throw (GeneralException) { + if (h == -1) { + throw GeneralException("Can't mmap() a virtual handle"); + } if (length == -1) { length = GetSize(); } diff --git a/lib/Main.cc b/lib/Main.cc index 74b83cc..4007abc 100644 --- a/lib/Main.cc +++ b/lib/Main.cc @@ -20,6 +20,11 @@ void Main::set_args(int a_argc, char ** a_argv, char ** a_enve) { setted = true; } +/* +_open_osfhandle +CreateFileMapping +*/ + int Main::truemain(Main * Application, int argc, char ** argv, char ** enve) { int r; |