Eina : eina_file_win32.c : add share mode when opening a file
authorcaro <caro>
Wed, 1 Jun 2011 06:18:56 +0000 (06:18 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 1 Jun 2011 06:18:56 +0000 (06:18 +0000)
On Windows, if you want to open the same file several times,
you have to tell it can... No ChangeLog as that code is work in
progress)

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@59857 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/eina_file_win32.c

index a16fd28..259dca6 100644 (file)
@@ -778,17 +778,20 @@ eina_file_open(const char *filename, Eina_Bool shared)
    /* FIXME: always open absolute path (need to fix filename according to current\r
       directory) */\r
 \r
+   /* FIXME: how to emulate shm_open ? Just OpenFileMapping ? */\r
+#if 0\r
    if (shared)\r
-     /* FIXME: shm_open is maybe not really that */\r
      handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ,\r
                          NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY,\r
                          NULL);\r
    else\r
-     handle = CreateFile(filename, GENERIC_READ, 0,\r
+#endif\r
+     handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ,\r
                          NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY,\r
                          NULL);\r
 \r
-   if (handle == INVALID_HANDLE_VALUE) return NULL;\r
+   if (handle == INVALID_HANDLE_VALUE)\r
+     return NULL;\r
 \r
    fm = CreateFileMapping(handle, NULL, PAGE_READONLY, 0, 0, NULL);\r
    if (!fm)\r