cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f71a78edcb2fbb2a6156abce3ab8f523eed09c66

commit f71a78edcb2fbb2a6156abce3ab8f523eed09c66
Author: Adrien Nader <adr...@notk.org>
Date:   Wed Feb 11 11:58:28 2015 +0100

    eina: correctly handle and report Eina_File error on Windows.
    
    @fix
---
 src/lib/eina/eina_file_win32.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c
index 01d0c9f..4398e0b 100644
--- a/src/lib/eina/eina_file_win32.c
+++ b/src/lib/eina/eina_file_win32.c
@@ -372,7 +372,7 @@ eina_file_real_close(Eina_File *file)
         free(map);
      }
 
-   if (file->global_map != MAP_FAILED)
+   if (file->global_map != MAP_FAILED && file->handle != NULL)
      UnmapViewOfFile(file->global_map);
 
    if (file->fm) CloseHandle(file->fm);
@@ -728,6 +728,17 @@ eina_file_open(const char *path, Eina_Bool shared)
 
    if (handle == INVALID_HANDLE_VALUE)
      {
+        LPVOID lpMsgBuf;
+
+        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                      FORMAT_MESSAGE_FROM_SYSTEM |
+                      FORMAT_MESSAGE_IGNORE_INSERTS,
+                      NULL,
+                      GetLastError(),
+                      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                      (LPTSTR) &lpMsgBuf,
+                      0, NULL);
+
         switch (GetLastError())
           {
            case ERROR_FILE_NOT_FOUND:

-- 


Reply via email to