Backport of Windows file sharing fix from default branch. stable-2.0
authorRyan C. Gordon <icculus@icculus.org>
Wed, 17 Mar 2010 17:11:21 -0400
branchstable-2.0
changeset 1068 a94dfe3d3121
parent 1061 8b05539d6660
child 1071 eb4b3f7cfb29
Backport of Windows file sharing fix from default branch.
platform/pocketpc.c
platform/windows.c
--- a/platform/pocketpc.c	Mon Mar 15 09:44:34 2010 -0400
+++ b/platform/pocketpc.c	Wed Mar 17 17:11:21 2010 -0400
@@ -331,8 +331,8 @@
     wchar_t *w_fname = NULL;
 
     UTF8_TO_UNICODE_STACK_MACRO(w_fname, fname);
-    fileHandle = CreateFile(w_fname, mode, FILE_SHARE_READ, NULL,
-                            creation, FILE_ATTRIBUTE_NORMAL, NULL);
+    fileHandle = CreateFile(w_fname, mode, FILE_SHARE_READ | FILE_SHARE_WRITE,
+                            NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL);
     __PHYSFS_smallFree(w_fname);
 
     BAIL_IF_MACRO(fileHandle == INVALID_HANDLE_VALUE, win32strerror(), NULL);
--- a/platform/windows.c	Mon Mar 15 09:44:34 2010 -0400
+++ b/platform/windows.c	Wed Mar 17 17:11:21 2010 -0400
@@ -989,8 +989,8 @@
 
     UTF8_TO_UNICODE_STACK_MACRO(wfname, fname);
     BAIL_IF_MACRO(wfname == NULL, ERR_OUT_OF_MEMORY, NULL);
-    fileHandle = pCreateFileW(wfname, mode, FILE_SHARE_READ, NULL,
-                              creation, FILE_ATTRIBUTE_NORMAL, NULL);
+    fileHandle = pCreateFileW(wfname, mode, FILE_SHARE_READ | FILE_SHARE_WRITE,
+                              NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL);
     __PHYSFS_smallFree(wfname);
 
     BAIL_IF_MACRO